// ToInt64 converts in to an int value
499250
func ToInt64(in interface{}) (int64, error) {
	if val, err := ToInt64E(in); err == nil {
		return val, nil
	}
	return 0, ErrBadType
}
16982
func ToInt(str string) (int64, error) {
	res, err := strconv.ParseInt(str, 0, 64)
	if err != nil {
		res = 0
	}
	return res, err
}
1079258
func (p *parser) Int64(i int, context string) int64 {
	s := p.String(i, context)
	if p.err != nil {
		return 0
	}
	if s == "" {
		return 0
	}
	v, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		p.SetErr(context, s)
	}
	return v
}
29631
func (d *Datum) ToInt64(sc *stmtctx.StatementContext) (int64, error) {
	return d.toSignedInteger(sc, mysql.TypeLonglong)
}
1229082
func (enc *Encoder) encodeInt64(n int64) ([]byte, error) {
	enc.buf = strconv.AppendInt(enc.buf, n, 10)
	return enc.buf, nil
}
739957
func (d *Datum) SetInt64(i int64) {
	d.k = KindInt64
	d.i = i
}
14653
func (s *Session) Int64(key string) int64 {
	s.RLock()
	defer s.RUnlock()

	v, ok := s.data[key]
	if !ok {
		return 0
	}

	value, ok := v.(int64)
	if !ok {
		return 0
	}
	return value
}
918593
func (m *Manager) GetInt64(key string) int64 {
	return cast.ToInt64(m.Get(key))
}
760222
func (v Value) Int64() (int64, error) {
	i, err := strconv.ParseInt(v.String(), 10, 64)
	if err != nil {
		return 0, v.invalidTypeError(err, "int64")
	}
	return i, nil
}
110153
func (d *Decoder) DecodeInt64() (int64, error) {
	c, err := d.readCode()
	if err != nil {
		return 0, err
	}
	return d.int(c)
}
502231
func ReadInt64(file string) (int64, error) {
	f, err := os.Open(file)
	if err != nil {
		return 0, err
	}
	defer f.Close()

	buf := make([]byte, 19)
	n, err := f.Read(buf)
	if err != nil {
		return 0, err
	}

	p := strings.Split(string(buf[0:n]), "\n")
	v, err := strconv.ParseInt(p[0], 10, 64)
	if err != nil {
		return 0, err
	}

	return v, nil
}
1227676
func (w *ByteWriter) WriteInt64(val int64, offset int) (int, error) {
	return w.WriteVal(val, offset)
}
1005683
func (h Hash) Int64(key string) (int64, error) {
	if value, ok := h[key]; ok {
		return value.Int64()
	}
	return 0, errors.New(ErrInvalidKey, errorMessages, key)
}
1265107
func (p *TCompactProtocol) bytesToInt64(b []byte) int64 {
	return int64(binary.LittleEndian.Uint64(b))
}
247455
func (c *cookies) Int64(key string) (int64, error) {
	ck, err := c.req.Cookie(key)
	if err != nil {
		return 0, err
	}
	return strconv.ParseInt(ck.Value, 10, 64)
}
901278
func ToInt64Slice(i interface{}, d ...[]int64) (r []int64) {
	v, err := TryToInt64Slice(i)
	if err != nil && len(d) > 0 {
		return d[0]
	}
	return v
}
659573
func (nn NullNumber) Int64() (int64, error) {
	if nn.IsNil() {
		return 0, errors.New("NullNumber is nil")
	}
	return strconv.ParseInt(nn.value.(string), 10, 64)
}