cbor

package
v2.10.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoerceInterfaceMapToStringMap

func CoerceInterfaceMapToStringMap(in interface{}) (interface{}, error)

CoerceInterfaceMapToStringMap converts map[interface{}]interface{} (interface maps) to map[string]interface{} (string maps) and []interface{} with interface maps to string maps. Relevant when serializing between CBOR and JSON.

It also handles the CBOR 'bignum' type as documented here: https://tools.ietf.org/html/rfc7049#section-2.4.2

func ParseDietCBOR

func ParseDietCBOR(b []byte) (map[string]interface{}, error)

ParseDietCBOR attempts to coerce the input byte array into valid CBOR. Assumes the input is "diet" CBOR which is like CBOR, except: 1. It is guaranteed to always be a map 2. It may or may not include the opening and closing markers "{}"

func ParseDietCBORToStruct added in v2.3.0

func ParseDietCBORToStruct(b []byte, v interface{}) error

Similar to ParseDietCBOR but outputs to a concrete struct, which meets the "top-level map" requirement of "diet" CBOR.

func ParseStandardCBOR

func ParseStandardCBOR(b []byte) (a interface{}, err error)

ParseStandardCBOR parses CBOR in "standards compliant" mode. Literal values are passed through "as-is". The input is not assumed to be a map. Empty inputs will return nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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