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

	return def
}
730853
func (r *Store) GetDefault(key string, def interface{}) interface{} {
	v, ok := r.GetEntry(key)
	if !ok || v.ValueRaw == nil {
		return def
	}
	vv := v.Value()
	if vv == nil {
		return def
	}
	return vv
}
247741
func (s *Session) GetFloat64Default(key string, defaultValue float64) float64 {
	if v, err := s.GetFloat64(key); err == nil {
		return v
	}

	return defaultValue
}
1267616
func (r *Store) GetInt16Default(key string, def int16) int16 {
	if v, err := r.GetInt16(key); err == nil {
		return v
	}

	return def
}
757908
func (e *InsertValues) getColDefaultValue(idx int, col *table.Column) (d types.Datum, err error) {
	if e.colDefaultVals != nil && e.colDefaultVals[idx].valid {
		return e.colDefaultVals[idx].val, nil
	}

	defaultVal, err := table.GetColDefaultValue(e.ctx, col.ToInfo())
	if err != nil {
		return types.Datum{}, err
	}
	if initialized := e.lazilyInitColDefaultValBuf(); initialized {
		e.colDefaultVals[idx].val = defaultVal
		e.colDefaultVals[idx].valid = true
	}

	return defaultVal, nil
}
28181
func (e Entry) Float64Default(def float64) (float64, error) {
	v := e.ValueRaw

	if v == nil {
		return def, fmt.Errorf(errFindParse, "float64", e.Key)
	}

	if vfloat32, ok := v.(float32); ok {
		return float64(vfloat32), nil
	}

	if vfloat64, ok := v.(float64); ok {
		return vfloat64, nil
	}

	if vint, ok := v.(int); ok {
		return float64(vint), nil
	}

	if vstring, sok := v.(string); sok {
		vfloat64, err := strconv.ParseFloat(vstring, 64)
		if err != nil {
			return def, err
		}

		return vfloat64, nil
	}

	return def, fmt.Errorf(errFindParse, "float64", e.Key)
}
747002
func (r *Store) GetUint8Default(key string, def uint8) uint8 {
	if v, err := r.GetUint8(key); err == nil {
		return v
	}

	return def
}
1225128
func (dec *Decoder) Int32(v *int32) error {
	err := dec.decodeInt32(v)
	if err != nil {
		return err
	}
	dec.called |= 1
	return nil
}
437781
func (r *Store) GetInt32(key string) (int32, error) {
	v, ok := r.GetEntry(key)
	if !ok {
		return -1, errFindParse.Format("int32", key)
	}
	return v.Int32Default(-1)
}
553722
func getInt(unk interface{}) int64 {
	switch i := unk.(type) {
	case int64:
		return i
	case float64:
		return int64(i)
	case string:
		v, err := strconv.ParseInt(i, 10, 64)
		if err != nil {
			return int64(0)
		}
		return v
	default:
		return int64(0)
	}
}
265265
func (r *Store) GetInt(key string) (int, error) {
	v, ok := r.GetEntry(key)
	if !ok {
		return 0, errFindParse.Format("int", key)
	}
	return v.IntDefault(-1)
}
293451
func GetDefault() *Shortid {
	return (*Shortid)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&shortid))))
}
1349110
func (context *BaseContext) GetInt64(
	key string, defaultValue ...int64) int64 {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(int64); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return 0
}
219230
func (c Context) Int32(key string, i int32) Context {
	c.l.context = enc.AppendInt32(enc.AppendKey(c.l.context, key), i)
	return c
}
1369026
func (context *BaseContext) GetInt(
	key string, defaultValue ...int) int {
	if value, ok := context.userData[key]; ok {
		if value, ok := value.(int); ok {
			return value
		}
	}
	if len(defaultValue) > 0 {
		return defaultValue[0]
	}
	return 0
}
259759
func (r *Store) GetInt8Default(key string, def int8) int8 {
	if v, err := r.GetInt8(key); err == nil {
		return v
	}

	return def
}
296738
func AskForIntWithDeafult(messageToPrint string, defaultValue int) (int64, error) {
	return AskForIntFromReaderWithDefault(messageToPrint, defaultValue, os.Stdin)
}