cbor

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CBOR_TYPE_BYTE_STRING uint8 = 0x40
	CBOR_TYPE_TEXT_STRING uint8 = 0x60
	CBOR_TYPE_ARRAY       uint8 = 0x80
	CBOR_TYPE_MAP         uint8 = 0xa0

	CBOR_TYPE_MASK uint8 = 0xe0
)

Variables

This section is empty.

Functions

func Decode

func Decode(dataBytes []byte, dest interface{}) (int, error)

func Encode

func Encode(data interface{}) ([]byte, error)

Types

type ByteString

type ByteString struct {
	// contains filtered or unexported fields
}

Wrapper for bytestrings that allows them to be used as keys for a map

func NewByteString

func NewByteString(data []byte) ByteString

func (ByteString) Bytes

func (bs ByteString) Bytes() []byte

func (ByteString) String

func (bs ByteString) String() string

func (*ByteString) UnmarshalCBOR

func (bs *ByteString) UnmarshalCBOR(data []byte) error

type RawMessage

type RawMessage = _cbor.RawMessage

Create an alias for RawMessage for convenience

type Value

type Value struct {
	Value interface{}
}

Helpful wrapper for parsing arbitrary CBOR data which may contain types that cannot be easily represented in Go (such as maps with bytestring keys)

func (*Value) UnmarshalCBOR

func (v *Value) UnmarshalCBOR(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL