Documentation
¶
Index ¶
- func NewArrayElement(values []Elementer) *arrayElement
- func NewBinElement(value []byte) *binElement
- func NewBoolElement(value bool) *boolElement
- func NewExtElement(value []byte) *extElement
- func NewFloatElement(value float64) *floatElement
- func NewIntElement(value int64) *intElement
- func NewNilElement() *nilElement
- func NewObjectElement(values []Elementer) *objectElement
- func NewStringElement(value string) *stringElement
- func NewUintElement(value uint64) *uintElement
- type ArrayWrapper
- type ElementType
- type Elementer
- type ObjectWrapper
- type TypeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewArrayElement ¶
func NewArrayElement(values []Elementer) *arrayElement
NewArrayElement creates an array from the given values.
func NewBinElement ¶
func NewBinElement(value []byte) *binElement
NewBinElement creates a binary element from the given bytes.
func NewBoolElement ¶
func NewBoolElement(value bool) *boolElement
NewBoolElement creates a bool element from the given value.
func NewExtElement ¶
func NewExtElement(value []byte) *extElement
NewExtElement creates an extension element from the given value.
func NewFloatElement ¶
func NewFloatElement(value float64) *floatElement
NewFloatElement creates a float element from the given value.
func NewIntElement ¶
func NewIntElement(value int64) *intElement
NewIntElement creates an integer element from the given value.
func NewObjectElement ¶
func NewObjectElement(values []Elementer) *objectElement
NewObjectElement creates an object from the given values.
func NewStringElement ¶
func NewStringElement(value string) *stringElement
NewStringElement creates a string element from the given value.
func NewUintElement ¶
func NewUintElement(value uint64) *uintElement
NewUintElement creates an unsigned integer element from the given value.
Types ¶
type ArrayWrapper ¶
type ArrayWrapper interface {
// Size returns the size of the array.
Size() int
// Get returns the element at the index postion.
Get(index int) Elementer
}
ArrayWrapper exposes methods to access the items of an array.
type ElementType ¶
type ElementType uint8
const ( // ElementTypeNil nil value ElementTypeNil ElementType = iota + 1 // ElementTypeBool bool value ElementTypeBool // ElementTypeFloat float value ElementTypeFloat // ElementTypeInt int value ElementTypeInt // ElementTypeUint uint value ElementTypeUint // ElementTypeString string value ElementTypeString // ElementTypeObject object value ElementTypeObject // ElementTypeArray array value ElementTypeArray // ElementTypeBin binary value ElementTypeBin // ElementTypeExtension extension value ElementTypeExtension )
func (ElementType) String ¶
func (i ElementType) String() string
type Elementer ¶
type Elementer interface {
// Type returns the type of the underlying value
Type() ElementType
// GetBool returns the boolean value or an error if the
// underlying value is not bool.
GetBool() (bool, error)
// GetFloat returns the float64 value or an error if the
// underlying value is not float64.
GetFloat() (float64, error)
// GetInt returns the int64 value or an error if the
// underlying value is not int64.
GetInt() (int64, error)
// GetUint returns the uint64 value or an error if the
// underlying value is not uint64.
GetUint() (uint64, error)
// GetString returns the string value or an error if the
// underlying value is not string.
GetString() (string, error)
// GetBytes returns the byte array value or an error if the
// underlying value is not []byte.
GetBytes() ([]byte, error)
// GetExtensionRaw returns raw msgpack encoded value of
// the underlying extension or an error if the
// underlying value is not extension.
GetExtensionRaw() ([]byte, error)
// AsArray returns an array wrapper if the underlying
// value is an array.
AsArray() (ArrayWrapper, error)
// AsObject returns an object wrapper if the underlying
// value is an object.
AsObject() (ObjectWrapper, error)
}
Click to show internal directories.
Click to hide internal directories.