// GetUint32Default returns the entry's value as uint32, based on its key.
// If not found returns "def".
779006
func (r *Store) GetUint32Default(key string, def uint32) uint32 {
	if v, err := r.GetUint32(key); err == nil {
		return v
	}

	return def
}
239970
func (context *BaseContext) GetUInt(
	key string, defaultValue ...uint) uint {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(uint); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return 0
}
159436
func (e Entry) Uint64Default(def uint64) (uint64, error) {
	v := e.ValueRaw
	if v == nil {
		return def, errFindParse.Format("uint64", e.Key)
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseUint(vv, 10, 64)
		if err != nil {
			return def, err
		}
		if val > math.MaxUint64 {
			return def, errFindParse.Format("uint64", e.Key)
		}
		return uint64(val), nil
	case uint8:
		return uint64(vv), nil
	case uint16:
		return uint64(vv), nil
	case uint32:
		return uint64(vv), nil
	case uint64:
		return vv, nil
	case int64:
		return uint64(vv), nil
	case int:
		return uint64(vv), nil
	}

	return def, errFindParse.Format("uint64", e.Key)
}
1112138
func (b *FastLogStore) GetUint64(key []byte) (uint64, error) {
	val, err := b.Get(key)
	if err != nil {
		return 0, err
	}
	if len(val) != 8 {
		return 0, errors.New("invalid number")
	}
	return binary.LittleEndian.Uint64(val), nil
}
120954
func (e Entry) Float32Default(key string, def float32) (float32, error) {
	v := e.ValueRaw
	if v == nil {
		return def, errFindParse.Format("float32", e.Key)
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseFloat(vv, 32)
		if err != nil {
			return def, err
		}
		if val > math.MaxFloat32 {
			return def, errFindParse.Format("float32", e.Key)
		}
		return float32(val), nil
	case float32:
		return vv, nil
	case float64:
		if vv > math.MaxFloat32 {
			return def, errFindParse.Format("float32", e.Key)
		}
		return float32(vv), nil
	case int:
		return float32(vv), nil
	}

	return def, errFindParse.Format("float32", e.Key)
}
460334
func (l *LogOptions) GetIntDefault(option string, value int) int {
	if v, found := l.ExtendedOptions[option]; found {
		return v.(int)
	}
	return value
}
200672
func (reader PluginConfigReaderWithError) GetUint(key string, defaultValue uint64) (uint64, error) {
	key = reader.config.registerKey(key)
	if reader.HasValue(key) {
		if strVal, err := reader.config.Settings.String(key); err == nil {
			return tstrings.AtoU64(strVal) // Allow string to number conversion
		}
		return reader.config.Settings.Uint(key)
	}
	return defaultValue, nil
}
1323123
func (m *Manager) GetUint32(key string) uint32 {
	return cast.ToUint32(m.Get(key))
}
747002
func (r *Store) GetUint8Default(key string, def uint8) uint8 {
	if v, err := r.GetUint8(key); err == nil {
		return v
	}

	return def
}
928748
func (b *SelectStmt) ReturnUint64() (uint64, error) {
	var v uint64
	err := b.LoadOne(&v)
	return v, err
}
1154872
func (d *Context) ToUint32(index int) uint32 {
	return uint32(C.duk_to_uint32(d.duk_context, C.duk_idx_t(index)))
}
1252819
func (c Context) Uint32(key string, i uint32) Context {
	c.l.context = enc.AppendUint32(enc.AppendKey(c.l.context, key), i)
	return c
}
942903
func (r *Store) GetUint16Default(key string, def uint16) uint16 {
	if v, err := r.GetUint16(key); err == nil {
		return v
	}

	return def
}
706920
func (b *BoltStore) GetUint64(key []byte) (uint64, error) {
	val, err := b.Get(key)
	if err != nil {
		return 0, err
	}
	return bytesToUint64(val), nil
}
140424
func (hdr *rpmHeader) GetUint32s(tag int) ([]uint32, error) {
	buf, n, err := hdr.getInts(tag)
	if err != nil {
		return nil, err
	}
	if out, ok := buf.([]uint32); ok {
		return out, nil
	}
	out := make([]uint32, n)
	switch bvals := buf.(type) {
	case []uint8:
		for i, v := range bvals {
			out[i] = uint32(v)
		}
	case []uint16:
		for i, v := range bvals {
			out[i] = uint32(v)
		}
	default:
		return nil, fmt.Errorf("tag %d is too big for int type", tag)
	}
	return out, nil
}
1267616
func (r *Store) GetInt16Default(key string, def int16) int16 {
	if v, err := r.GetInt16(key); err == nil {
		return v
	}

	return def
}
1294216
func (s Session) GetDefault(key string, value interface{}, defaultValue interface{}) interface{} {
	v, e := s.GetInto(key, value, false)
	if e != nil {
		v = defaultValue
	}
	return v
}