Documentation ¶
Overview ¶
package kv provides basic key and value types.
Index ¶
- type Key
- func (k Key) Array(v interface{}) KeyValue
- func (k Key) Bool(v bool) KeyValue
- func (k Key) Defined() bool
- func (k Key) Float32(v float32) KeyValue
- func (k Key) Float64(v float64) KeyValue
- func (k Key) Int(v int) KeyValue
- func (k Key) Int32(v int32) KeyValue
- func (k Key) Int64(v int64) KeyValue
- func (k Key) String(v string) KeyValue
- func (k Key) Uint(v uint) KeyValue
- func (k Key) Uint32(v uint32) KeyValue
- func (k Key) Uint64(v uint64) KeyValue
- type KeyValue
- func Array(k string, v interface{}) KeyValue
- func Bool(k string, v bool) KeyValue
- func Float32(k string, v float32) KeyValue
- func Float64(k string, v float64) KeyValue
- func Infer(k string, value interface{}) KeyValue
- func Int(k string, v int) KeyValue
- func Int32(k string, v int32) KeyValue
- func Int64(k string, v int64) KeyValue
- func String(k, v string) KeyValue
- func Stringer(k string, v fmt.Stringer) KeyValue
- func Uint(k string, v uint) KeyValue
- func Uint32(k string, v uint32) KeyValue
- func Uint64(k string, v uint64) KeyValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key string
Key represents the key part in key-value pairs. It's a string. The allowed character set in the key depends on the use of the key.
func (Key) Array ¶ added in v0.7.0
Array creates a KeyValue instance with a ARRAY Value.
If creating both key and a array value at the same time, then instead of calling kv.Key(name).String(value) consider using a convenience function provided by the api/key package - key.Array(name, value).
func (Key) Bool ¶
Bool creates a KeyValue instance with a BOOL Value.
If creating both key and a bool value at the same time, then instead of calling kv.Key(name).Bool(value) consider using a convenience function provided by the api/key package - key.Bool(name, value).
func (Key) Float32 ¶
Float32 creates a KeyValue instance with a FLOAT32 Value.
If creating both key and a float32 value at the same time, then instead of calling kv.Key(name).Float32(value) consider using a convenience function provided by the api/key package - key.Float32(name, value).
func (Key) Float64 ¶
Float64 creates a KeyValue instance with a FLOAT64 Value.
If creating both key and a float64 value at the same time, then instead of calling kv.Key(name).Float64(value) consider using a convenience function provided by the api/key package - key.Float64(name, value).
func (Key) Int ¶
Int creates a KeyValue instance with either an INT32 or an INT64 Value, depending on whether the int type is 32 or 64 bits wide.
If creating both key and an int value at the same time, then instead of calling kv.Key(name).Int(value) consider using a convenience function provided by the api/key package - key.Int(name, value).
func (Key) Int32 ¶
Int32 creates a KeyValue instance with an INT32 Value.
If creating both key and an int32 value at the same time, then instead of calling kv.Key(name).Int32(value) consider using a convenience function provided by the api/key package - key.Int32(name, value).
func (Key) Int64 ¶
Int64 creates a KeyValue instance with an INT64 Value.
If creating both key and an int64 value at the same time, then instead of calling kv.Key(name).Int64(value) consider using a convenience function provided by the api/key package - key.Int64(name, value).
func (Key) String ¶
String creates a KeyValue instance with a STRING Value.
If creating both key and a string value at the same time, then instead of calling kv.Key(name).String(value) consider using a convenience function provided by the api/key package - key.String(name, value).
func (Key) Uint ¶
Uint creates a KeyValue instance with either a UINT32 or a UINT64 Value, depending on whether the uint type is 32 or 64 bits wide.
If creating both key and a uint value at the same time, then instead of calling kv.Key(name).Uint(value) consider using a convenience function provided by the api/key package - key.Uint(name, value).
func (Key) Uint32 ¶
Uint32 creates a KeyValue instance with a UINT32 Value.
If creating both key and a uint32 value at the same time, then instead of calling kv.Key(name).Uint32(value) consider using a convenience function provided by the api/key package - key.Uint32(name, value).
type KeyValue ¶
KeyValue holds a key and value pair.
func Array ¶ added in v0.7.0
Array creates a new key-value pair with a passed name and a array. Only arrays of primitive type are supported.
func Infer ¶
Infer creates a new key-value pair instance with a passed name and automatic type inference. This is slower, and not type-safe.
func Int ¶
Int creates a new key-value pair instance with a passed name and either an int32 or an int64 value, depending on whether the int type is 32 or 64 bits wide.
func Stringer ¶
Stringer creates a new key-value pair with a passed name and a string value generated by the passed Stringer interface.
func Uint ¶
Uint creates a new key-value pair instance with a passed name and either an uint32 or an uint64 value, depending on whether the uint type is 32 or 64 bits wide.