cbor

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cbor provides Juno's CBOR API. Encoding and decoding currently use the fxamacker adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v any) ([]byte, error)

Marshal returns the CBOR encoding of v.

func RegisterType

func RegisterType(t reflect.Type) error

RegisterType gives a unique CBOR tag to a type. Only call this from utils/cbor/registry's init, before concurrent use.

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal decodes a CBOR value from data into v.

func UnmarshalFirst

func UnmarshalFirst(data []byte, v any) ([]byte, error)

UnmarshalFirst decodes the first CBOR item and returns the remaining bytes.

func UnmarshalStrict

func UnmarshalStrict(data []byte, v any) error

UnmarshalStrict decodes without type tags and rejects unknown fields. It is used to check that projections match their stored records.

Types

type Encoder

type Encoder = fxamacker.Encoder

Encoder writes CBOR values to a stream.

func NewEncoder

func NewEncoder(w io.Writer) Encoder

NewEncoder returns an encoder that writes to w.

type RawMessage

type RawMessage = fxamacker.RawMessage

RawMessage is an item that is already CBOR encoded.

type SelfDecoder

type SelfDecoder = fxamacker.SelfDecoder

SelfDecoder is the hook a type implements to read its own encoding.

type SelfEncoder

type SelfEncoder = fxamacker.SelfEncoder

SelfEncoder is the hook a type implements to write its own encoding.

Directories

Path Synopsis
internal
cursor
Package cursor reads CBOR from a byte slice in a single pass.
Package cursor reads CBOR from a byte slice in a single pass.

Jump to

Keyboard shortcuts

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