cbor

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cbor wraps github.com/fxamacker/cbor/v2 as a codec.Codec implementation. fxamacker exposes an Encoder and Decoder that stream individual CBOR items, so this codec also implements StreamingCodec.

Package cbor — range 0.3.6.* (ADR 0005 service/codec/cbor block).

Package cbor — adapts fxamacker's *Decoder to codec.Decoder.

Package cbor — adapts fxamacker's *Encoder to codec.Encoder.

Package cbor — declares the sentinel *errs.Error values for CBOR.

Index

Constants

View Source
const CodeCBORMarshalFailed errs.Code = 0x00_03_06_01 // 0.3.6.1

CodeCBORMarshalFailed identifies a failure inside fxamacker/cbor/v2.Marshal.

View Source
const CodeCBORUnmarshalFailed errs.Code = 0x00_03_06_02 // 0.3.6.2

CodeCBORUnmarshalFailed identifies a failure inside fxamacker/cbor/v2.Unmarshal.

Variables

View Source
var (
	// MarshalFailed wraps a failure from fxamacker/cbor/v2.Marshal.
	MarshalFailed = errs.Define(CodeCBORMarshalFailed, "MARSHAL_FAILED",
		"CBOR encoding failed",
		"service/codec/cbor: github.com/fxamacker/cbor/v2.Marshal returned an error")

	// UnmarshalFailed wraps a failure from fxamacker/cbor/v2.Unmarshal.
	UnmarshalFailed = errs.Define(CodeCBORUnmarshalFailed, "UNMARSHAL_FAILED",
		"CBOR decoding failed",
		"service/codec/cbor: github.com/fxamacker/cbor/v2.Unmarshal returned an error")
)
View Source
var (
	//: register the singleton and expose it as a typed package var.
	Codec codec.Codec = codec.Register(&cborCodec{})
)

Package-level state: the codec singleton plus the hoisted MIME / extension tables (hoisted).

Functions

func New

func New() codec.Codec

New returns a CBOR codec instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

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