encoding

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopulateStructFromCBOR

func PopulateStructFromCBOR(dm cbor.DecMode, data []byte, dest any) error

func PopulateStructFromJSON

func PopulateStructFromJSON(data []byte, dest any) error

func SerializeStructToCBOR

func SerializeStructToCBOR(em cbor.EncMode, source any) ([]byte, error)

func SerializeStructToJSON

func SerializeStructToJSON(source any) ([]byte, error)

Types

type TypeAndValue

type TypeAndValue struct {
	Type  string          `json:"type"`
	Value json.RawMessage `json:"value"`
}

TypeAndValue stores a JSON object with two attributes: a string "type" and a generic "value" (string) defined by type. This type is used in a few places to implement the choice types that CBOR handles using tags.

func (*TypeAndValue) UnmarshalJSON

func (o *TypeAndValue) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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