Documentation ¶
Index ¶
- func Decode(in []byte) (interface{}, error)
- func DecodeArray(fb byte, r *bytes.Reader) ([]interface{}, error)
- func DecodeBytes(fb byte, r *bytes.Reader) ([]byte, error)
- func DecodeFloat16(_ byte, r *bytes.Reader) (interface{}, error)
- func DecodeFloat32(_ byte, r *bytes.Reader) (interface{}, error)
- func DecodeFloat64(_ byte, r *bytes.Reader) (interface{}, error)
- func DecodeInt(fb byte, r *bytes.Reader) (int64, error)
- func DecodeMap(fb byte, r *bytes.Reader) (map[interface{}]interface{}, error)
- func DecodeSimple(fb byte, r *bytes.Reader) (interface{}, error)
- func DecodeString(fb byte, r *bytes.Reader) (string, error)
- func DecodeTag(fb byte, r *bytes.Reader) (interface{}, error)
- func DecodeUint(fb byte, r *bytes.Reader) (uint64, error)
- func Encode(in interface{}) []byte
- func EncodeArray(arr interface{}) []byte
- func EncodeBytes(b []byte) []byte
- func EncodeFloat(in float64) []byte
- func EncodeInt(i int64) []byte
- func EncodeMap(in interface{}) []byte
- func EncodeString(s string) []byte
- func EncodeStruct(in interface{}) []byte
- func EncodeUint(i uint64) []byte
- type Encoder
- type Marshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeArray ¶
DecodeArray decodes a cbor value to an array of arbitrary types
func DecodeBytes ¶
DecodeBytes decodes a cbor value to a byte slice
func DecodeFloat16 ¶
DecodeFloat16 decodes a cbor value to a 64-bit floating point value (the cbor value was 16-bit though)
func DecodeFloat32 ¶
DecodeFloat32 decodes a cbor value to a 32-bit floating point value
func DecodeFloat64 ¶
DecodeFloat64 decodes a cbor value to a 64-bit floating point value
func DecodeSimple ¶
DecodeSimple decodes the second byte of a simple cbor value - no values are defined in this range in RFC7049 so this will always cause an error. This behavior is not strictly conformant to RFC7049 but there is no easy way to return the raw value without it being ambigous.
func DecodeString ¶
DecodeString decodes a cbor value to a string
func DecodeTag ¶
DecodeTag decodes a tag and following data element, if possible using a registered tag decoder
func DecodeUint ¶
DecodeUint decodes a cbor value to an uint64
func Encode ¶
func Encode(in interface{}) []byte
Encode encodes an arbitrary type or data structure as a cbor value
func EncodeArray ¶
func EncodeArray(arr interface{}) []byte
EncodeArray encodes an array of arbitrary types to a cbor value
func EncodeBytes ¶
EncodeBytes encodes a byte slice to a cbor value
func EncodeFloat ¶
EncodeFloat encodes a 64-bit floating point value to a cbor value
func EncodeMap ¶
func EncodeMap(in interface{}) []byte
EncodeMap encodes a map using arbitrary types as keys and values to a cbor value
func EncodeString ¶
EncodeString encodes a string to a cbor value
func EncodeStruct ¶
func EncodeStruct(in interface{}) []byte
EncodeStruct encodes a struct (treated as a map) to a cbor value