Documentation
¶
Index ¶
- Constants
- func Convert(src, dest any) error
- func Decode(l *Buffer, v interface{}) (err error)
- func DeepCopy[T any](v T) (T, error)
- func Encode(l *Buffer, v interface{}) (err error)
- func EqualBuffer(x, y *Buffer) bool
- func Ptr[T any](t T) *T
- func PutBuffer(l *Buffer)
- func TypeFor[T any]() reflect.Type
- type Buffer
- type InvalidDecodeError
- type Kind
- type Number
- type Value
- func (p *Value) Bool() bool
- func (p *Value) Bools() []bool
- func (p *Value) Float() float64
- func (p *Value) Float32s() []float32
- func (p *Value) Float64s() []float64
- func (p *Value) Int() int64
- func (p *Value) Int16s() []int16
- func (p *Value) Int32s() []int32
- func (p *Value) Int64s() []int64
- func (p *Value) Int8s() []int8
- func (p *Value) Ints() []int
- func (p *Value) SetBool(b bool)
- func (p *Value) SetBools(s []bool)
- func (p *Value) SetFloat(f float64)
- func (p *Value) SetFloat32s(s []float32)
- func (p *Value) SetFloat64s(s []float64)
- func (p *Value) SetInt(i int64)
- func (p *Value) SetInt16s(s []int16)
- func (p *Value) SetInt32s(s []int32)
- func (p *Value) SetInt64s(s []int64)
- func (p *Value) SetInt8s(s []int8)
- func (p *Value) SetInts(s []int)
- func (p *Value) SetString(s string)
- func (p *Value) SetStrings(s []string)
- func (p *Value) SetUint(u uint64)
- func (p *Value) SetUint16s(s []uint16)
- func (p *Value) SetUint32s(s []uint32)
- func (p *Value) SetUint64s(s []uint64)
- func (p *Value) SetUint8s(s []uint8)
- func (p *Value) SetUints(s []uint)
- func (p *Value) String() string
- func (p *Value) Strings() []string
- func (p *Value) Uint() uint64
- func (p *Value) Uint16s() []uint16
- func (p *Value) Uint32s() []uint32
- func (p *Value) Uint64s() []uint64
- func (p *Value) Uint8s() []uint8
- func (p *Value) Uints() []uint
Constants ¶
const ( Invalid = Kind(iota) Nil Bool Int Uint Float String Bools Ints Int8s Int16s Int32s Int64s Uints Uint8s Uint16s Uint32s Uint64s Float32s Float64s Strings Slice Map )
Variables ¶
This section is empty.
Functions ¶
func EqualBuffer ¶
EqualBuffer reports whether x and y are the same [Value]s.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
A Buffer is a variable-sized buffer of Value.
type InvalidDecodeError ¶
An InvalidDecodeError describes an invalid argument passed to Decode. (The argument to Decode must be a non-nil pointer.)
func (*InvalidDecodeError) Error ¶
func (e *InvalidDecodeError) Error() string
type Value ¶
type Value struct { Data uintptr Length int // number of children First int // position of first Type Kind // to prevent overflow Name string }
Value is used to store a value. When the Type is Bool, Int, Uint, Float, only the Data field is used. When the Type is String, the Data and Length fields are used. When the Type is [Type]s, the Data, Length, and First fields are used.
func (*Value) SetFloat32s ¶
SetFloat32s sets v's underlying value.
func (*Value) SetFloat64s ¶
SetFloat64s sets v's underlying value.
func (*Value) SetStrings ¶
SetStrings sets v's underlying value.
func (*Value) SetUint16s ¶
SetUint16s sets v's underlying value.
func (*Value) SetUint32s ¶
SetUint32s sets v's underlying value.
func (*Value) SetUint64s ¶
SetUint64s sets v's underlying value.