// MustInt32 gets data int32
428792
func (c *secureCookies) MustInt32(key string, defaults ...int32) int32 {
	ck, err := c.req.Cookie(key)
	if err != nil {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return 0
	}
	s := parseSecureCookie(c.secret, ck.Value)
	v, err := strconv.ParseInt(s, 10, 32)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return int32(v)
}
246566
func (k *Key) MustInt64(defaultVal ...int64) int64 {
	val, err := k.Int64()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatInt(defaultVal[0], 10)
		return defaultVal[0]
	}
	return val
}
1344752
func (c *cookies) Int32(key string) (int32, error) {
	ck, err := c.req.Cookie(key)
	if err != nil {
		return 0, err
	}
	v, err := strconv.ParseInt(ck.Value, 10, 32)
	return int32(v), err
}
690209
func (u *Unit) MustNewValue(value int64, explicitSign Sign) *Value {
	v, err := u.NewValue(value, explicitSign)
	if err != nil {
		panic(fmt.Sprintf("MustNewValue error: %v", err))
	}
	return v
}
219230
func (c Context) Int32(key string, i int32) Context {
	c.l.context = enc.AppendInt32(enc.AppendKey(c.l.context, key), i)
	return c
}
581345
func (p *Params) MustUint64(key string, defaults ...uint64) uint64 {
	r, err := strconv.ParseUint(p.Get(key), 10, 64)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return r
}
1225128
func (dec *Decoder) Int32(v *int32) error {
	err := dec.decodeInt32(v)
	if err != nil {
		return err
	}
	dec.called |= 1
	return nil
}
300755
func (p *Params) MustInt64(key string, defaults ...int64) int64 {
	r, err := strconv.ParseInt(p.Get(key), 10, 64)
	if len(defaults) > 0 && err != nil {
		return defaults[0]
	}
	return r
}
215008
func (k *Key) MustUint64(defaultVal ...uint64) uint64 {
	val, err := k.Uint64()
	if len(defaultVal) > 0 && err != nil {
		k.value = strconv.FormatUint(defaultVal[0], 10)
		return defaultVal[0]
	}
	return val
}
909163
func readInt32(rd io.Reader) (int32, error) {
	var i int32
	if err := binary.Read(rd, binary.LittleEndian, &i); err != nil {
		return 0, err
	}
	return i, nil
}
1071114
func MustInt64(s string, defaultVal ...int64) int64 {
	getDefault := func() int64 {
		if len(defaultVal) > 0 {
			return defaultVal[0]
		}
		return 0
	}

	if s == "" {
		return getDefault()
	}

	i, err := strconv.ParseInt(strings.TrimSpace(s), 10, 64)
	if err != nil {
		msg := "goutils MustInt64 strconv.ParseInt error:" + err.Error()
		// 加上文件调用和行号
		_, callerFile, line, ok := runtime.Caller(1)
		if ok {
			msg += fmt.Sprintf("file:%s,line:%d", callerFile, line)
		}
		log.Println(msg)
		log.Println("goutils MustInt64 strconv.ParseInt error:", err)
		return getDefault()
	}

	return i
}
457504
func (ctx *Context) ParamInt32(key string, defaults ...int32) int32 {
	return ctx.Params().MustInt32(key, defaults...)
}
638612
func MustReadVarInt64(r io.Reader) int64 {
	i64, err := ReadVarInt64(r)
	if err != nil {
		panic(err)
	}
	return i64
}
1041496
func (w *ByteWriter) MustWriteVal(val interface{}, offset int) int {
	if off, err := w.WriteVal(val, offset); err != nil {
		panic(err)
	} else {
		return off
	}
}
557929
func (w *ByteWriter) MustWriteFloat32(val float32, offset int) int {
	return w.MustWriteVal(val, offset)
}
247512
func (v *Value) MustMSI() map[string]interface{} {
	if s, ok := v.data.(Map); ok {
		return map[string]interface{}(s)
	}
	return v.data.(map[string]interface{})
}
685308
func (r *MockResult) Int32(i int) int32 {
	if r.Contains(i) {
		return r.Result[i].(int32)
	} else {
		return 0
	}
}