// IntWithKey retrieves an int from target that matches key, 0 when not found
422085
func IntWithKey(target interface{}, key string) int {
	item, err := fieldWithKey(target, key)
	if err != nil {
		return 0
	}

	field := reflect.ValueOf(target).Elem().FieldByName(item)

	if field.Kind() == reflect.Int {
		ptr := field.Addr().Interface().(*int)

		return int(*ptr)
	}

	return 0
}
1053945
func WithKeyValue(ctx context.Context, key, value string) context.Context {
	var logger *zap.Logger
	if ctxLogger, ok := ctx.Value(ctxLogKey).(*zap.Logger); ok {
		logger = ctxLogger
	} else {
		logger = zaplog.L()
	}
	return context.WithValue(ctx, ctxLogKey, logger.With(zap.String(key, value)))
}
292870
func (e *Event) Int(key string, i int) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendInt(enc.AppendKey(e.buf, key), i)
	return e
}
923182
func WithQueryCount(parent context.Context, value ...bool) context.Context {
	v := true
	if len(value) > 0 {
		v = value[0]
	}
	return context.WithValue(contextOrBackground(parent), keyQueryCount, v)
}
382456
func (c Context) Int8(key string, i int8) Context {
	c.l.context = enc.AppendInt8(enc.AppendKey(c.l.context, key), i)
	return c
}
1352586
func WithField(key string, value interface{}) Entry {
	ne := newEntryWithFields(logFields)
	ne.Fields = append(ne.Fields, Field{Key: key, Value: value})
	return ne
}
1064208
func (e *Event) Int32(key string, i int32) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendInt32(enc.AppendKey(e.buf, key), i)
	return e
}
875242
func (mmap MarshalMap) Int(key string) (int64, error) {
	val, exists := mmap.Value(key)
	if !exists {
		return 0, fmt.Errorf(`"%s" is not set`, key)
	}

	if intVal, isNumber := treflect.Int64(val); isNumber {
		return intVal, nil
	}

	return 0, fmt.Errorf(`"%s" is expected to be a signed number type`, key)
}
1307149
func (c *Context) GetInt(key string) (i int) {
	if val, ok := c.Get(key); ok && val != nil {
		i, _ = val.(int)
	}
	return
}
1132367
func (c *Client) WithMasterKey(masterKey string) *Client {
	newClient, _ := NewClient(c.appID, "")
	newClient.masterKey = masterKey
	newClient.logger = c.logger
	return newClient
}
472814
func (f *Queries) Int32(key string) (int32, error) {
	s, err := f.String(key)
	if err != nil {
		return 0, err
	}
	v, err := strconv.ParseInt(s, 10, 32)
	return int32(v), err
}
942631
func (it *iterator) Key() []byte {
	if len(it.keys) > 0 {
		return []byte(it.keys[0])
	}
	return nil
}
149045
func WithEntry(k string, v interface{}) Entry {
	return &generic{key: k, value: v}
}
944308
func Int(key string, fallback int) int {
	return DefaultClient.Int(key, fallback)
}
1299543
func IntKeySet(theMap interface{}) Int {
	v := reflect.ValueOf(theMap)
	ret := Int{}

	for _, keyValue := range v.MapKeys() {
		ret.Insert(keyValue.Interface().(int))
	}
	return ret
}
221531
func (c *causeT) With(keyvals ...interface{}) Error {
	return &causeT{
		errorT: c.errorT.withKeyvals(keyvals),
		cause:  c.cause,
	}
}
1208968
func (cache *Cache) GetIntWithExpiration(key int64) (value []byte, expireAt uint32, err error) {
	var bKey [8]byte
	binary.LittleEndian.PutUint64(bKey[:], uint64(key))
	return cache.GetWithExpiration(bKey[:])
}