// Dt8ForInts returns a Dt8 value for a UTC year, month, day, hour, minute and second.
8892
func Dt14ForInts(yyyy, mm, dd, hr, mn, dy int) int64 {
	sDt14 := fmt.Sprintf("%04d%02d%02d%02d%02d%02d", yyyy, mm, dd, hr, mn, dy)
	iDt14, err := strconv.ParseInt(sDt14, 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(iDt14)
}
1031338
func (Encoder) AppendUints8(dst []byte, vals []uint8) []byte {
	if len(vals) == 0 {
		return append(dst, '[', ']')
	}
	dst = append(dst, '[')
	dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
	if len(vals) > 1 {
		for _, val := range vals[1:] {
			dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
		}
	}
	dst = append(dst, ']')
	return dst
}
360834
func (c Context) Ints(key string, i []int) Context {
	c.l.context = enc.AppendInts(enc.AppendKey(c.l.context, key), i)
	return c
}
688959
func (j *JsonQuery) ArrayOfInts(s ...string) ([]int, error) {
	array, err := j.Array(s...)
	if err != nil {
		return []int{}, err
	}
	toReturn := make([]int, len(array))
	for index, val := range array {
		toReturn[index], err = intFromInterface(val)
		if err != nil {
			return toReturn, err
		}
	}
	return toReturn, nil
}
317830
func dayOfMonthWithSuffix(t *mysqlTime, input string, ctx map[string]int) (string, bool) {
	month, remain := parseOrdinalNumbers(input)
	if month >= 0 {
		t.month = uint8(month)
		return remain, true
	}
	return input, false
}
365610
func (m *Manager) GetInt8(key string) int8 {
	return cast.ToInt8(m.Get(key))
}
1125664
func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) {
	switch version {
	case v1.SchemeGroupVersion:
		return &meta.VersionInterfaces{
			ObjectConvertor:  api.Scheme,
			MetadataAccessor: accessor,
		}, nil
	default:
		g, _ := registered.Group(autoscaling.GroupName)
		return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions)
	}
}
129922
func (e *Event) Ints8(key string, i []int8) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendInts8(enc.AppendKey(e.buf, key), i)
	return e
}
68809
func Ints(data []int) []int {
	sort.Ints(data)
	n := Uniq(sort.IntSlice(data))
	return data[:n]
}
147592
func TryToInt8(i interface{}) (r int8, err error) {
	switch t := i.(type) {
	case nil:
		r = 0
	case int:
		r = int8(t)
	case int8:
		r = t
	case *int8:
		r = *t
	case int16:
		r = int8(t)
	case int32:
		r = int8(t)
	case int64:
		r = int8(t)
	case uint:
		r = int8(t)
	case uint8:
		r = int8(t)
	case uint16:
		r = int8(t)
	case uint32:
		r = int8(t)
	case uint64:
		r = int8(t)
	case float32:
		r = int8(t)
	case float64:
		r = int8(t)
	case bool:
		if t {
			r = 1
		}
	case string:
		var v int64
		if v, err = strconv.ParseInt(t, 10, 8); err == nil {
			r = int8(v)
		}
	default:
		err = castError(i, "int8")
	}
	return
}
800067
func (e *Encoder) EncodeInt8(n int8) error {
	return e.write1(codes.Int8, uint8(n))
}
611014
func AtForString(hour int, minute int, duration int) string {
	if hour < 0 || hour > 23 {
		if duration > 0 {
			hour = 0
		} else {
			return ""
		}
	}
	if hour == 0 && minute == 0 && duration == 0 {
		return ""
	}
	atString := fmt.Sprintf("@%02d", hour)
	if minute < 0 || minute > 59 {
		minute = 0
	}
	atString += fmt.Sprintf(":%02d", minute)
	if duration > 0 {
		var forString string
		days := duration / 1440
		hours := duration / 60 % 24
		minutes := duration % 60
		if days > 0 {
			forString += fmt.Sprintf("%dd", days)
		}
		if hours > 0 {
			forString += fmt.Sprintf("%dh", hours)
		}
		if minutes > 0 {
			forString += fmt.Sprintf("%dm", minutes)
		}
		if days > 0 && hours == 0 && minutes == 0 && hour == 0 && minute == 0 {
			return "for " + forString
		} else {
			return atString + " for " + forString
		}
	} else {
		return atString
	}
}
328198
func DurationForNowSubDt8(dt8 int32) (time.Duration, error) {
	t, err := TimeForDt8(dt8)
	if err != nil {
		var d time.Duration
		return d, err
	}
	now := time.Now()
	return now.Sub(t), nil
}
250232
func Int8(v int8) *int8 {
	p := new(int8)
	*p = v
	return p
}
50315
func Int8(db XODB, v0 int16, v1 int, v2 pgtypes.Oid, v3 float32, v4 float64, v5 uint8, v6 float64) (int64, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.int8($1, $2, $3, $4, $5, $6, $7)`

	// run query
	var ret int64
	XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6)
	err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6).Scan(&ret)
	if err != nil {
		return 0, err
	}

	return ret, nil
}
47534
func (e Entry) Int8Default(def int8) (int8, error) {
	v := e.ValueRaw
	if v == nil {
		return def, errFindParse.Format("int8", e.Key)
	}

	switch vv := v.(type) {
	case string:
		val, err := strconv.ParseInt(vv, 10, 8)
		if err != nil {
			return def, err
		}
		return int8(val), nil
	case int:
		return int8(vv), nil
	case int8:
		return vv, nil
	case int16:
		return int8(vv), nil
	case int32:
		return int8(vv), nil
	case int64:
		return int8(vv), nil
	}

	return def, errFindParse.Format("int8", e.Key)
}
306584
func builtinFromDays(args []types.Datum, ctx context.Context) (d types.Datum, err error) {
	days, err := args[0].ToInt64(ctx.GetSessionVars().StmtCtx)
	d.SetMysqlTime(types.TimeFromDays(days))
	return d, nil
}