// InInt64 always returns value without error,
// it returns default value if error occurs or doesn't fit into candidates.
492537
func (k *Key) InInt64(defaultVal int64, candidates []int64) int64 {
	val := k.MustInt64()
	for _, cand := range candidates {
		if val == cand {
			return val
		}
	}
	return defaultVal
}
141282
func (i Int) Int64() (_ int64, ok bool) {
	x, acc := bigintToInt64(i.bigint)
	if acc != big.Exact {
		return // inexact
	}
	return x, true
}
203671
func (ec *Envcfg) GetInt64(key string, base, bitSize int) int64 {
	i, _ := strconv.ParseInt(ec.GetKey(key), base, bitSize)
	return i
}
132459
func Int64(v []byte, err error) (int64, error) {
	if err != nil {
		return 0, err
	} else if v == nil || len(v) == 0 {
		return 0, nil
	} else if len(v) != 8 {
		return 0, errIntNumber
	}

	return int64(binary.LittleEndian.Uint64(v)), nil
}
1268530
func Int64(i int64) NullInt64 {
	return NullInt64{
		sql.NullInt64{
			Int64: i,
			Valid: true,
		},
	}
}
22829
func (c *Config) GetInt64(key string) (i int64) {
	i64, _ := c.GetInt64Ok(key)
	return i64
}
1304740
func (context *BaseContext) SetInt64(key string, value int64) {
	context.userData[key] = value
}
75115
func NewInt64(v int64) Value {
	return MakeTrusted(Int64, strconv.AppendInt(nil, v, 10))
}
1072129
func (r *Reply) Int64() (int64, error) {
	if r.Type == ErrorReply {
		return 0, r.Err
	}
	if r.Type != IntegerReply {
		s, err := r.Str()
		if err == nil {
			i64, err := strconv.ParseInt(s, 10, 64)
			if err != nil {
				return 0, errors.New("failed to parse integer value from string value")
			} else {
				return i64, nil
			}
		}

		return 0, errors.New("integer value is not available for this reply type")
	}

	return r.int, nil
}
647019
func (g *Group) Int64() *Statement {
	// notest
	s := Int64()
	g.items = append(g.items, s)
	return s
}
882815
func (f *Forms) Int64(key string) (int64, error) {
	return strconv.ParseInt((*http.Request)(f).FormValue(key), 10, 64)
}
187796
func toInt64(v interface{}) int64 {
	if str, ok := v.(string); ok {
		iv, err := strconv.ParseInt(str, 10, 64)
		if err != nil {
			return 0
		}
		return iv
	}

	val := reflect.Indirect(reflect.ValueOf(v))
	switch val.Kind() {
	case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
		return val.Int()
	case reflect.Uint8, reflect.Uint16, reflect.Uint32:
		return int64(val.Uint())
	case reflect.Uint, reflect.Uint64:
		tv := val.Uint()
		if tv <= math.MaxInt64 {
			return int64(tv)
		}
		// TODO: What is the sensible thing to do here?
		return math.MaxInt64
	case reflect.Float32, reflect.Float64:
		return int64(val.Float())
	case reflect.Bool:
		if val.Bool() == true {
			return 1
		}
		return 0
	default:
		return 0
	}
}
690983
func (enc *Encoder) Int64(v int64) {
	enc.grow(10)
	r := enc.getPreviousRune()
	if r != '[' {
		enc.writeByte(',')
	}
	enc.buf = strconv.AppendInt(enc.buf, v, 10)
}
739043
func (m Memory) Int64() int64 {
	i, err := strconv.ParseInt(string(m.Val), 10, 64)
	if err != nil && err.Error() != "strconv.ParseInt: parsing \"\"\"\": invalid syntax converting memory to int64" {
		m.log.Debugf("could not convert memory to int64 %s (%s, %s)",
			err, m.Key, string(m.Val))
	}
	return i
}
29631
func (d *Datum) ToInt64(sc *stmtctx.StatementContext) (int64, error) {
	return d.toSignedInteger(sc, mysql.TypeLonglong)
}
103831
func toInt64(v reflect.Value) int64 {
	i, _ := tryToInt64(v)
	return i
}
1068734
func (r *Store) GetInt64(key string) (int64, error) {
	v, ok := r.GetEntry(key)
	if !ok {
		return -1, errFindParse.Format("int64", key)
	}
	return v.Int64Default(-1)
}