Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CBorEncoder ¶
type CBorEncoder struct {
EncOpts cbor.EncOptions
}
CBorEncoder is a concrete implementation of the Encoder interface that uses the CBOR (Concise Binary Object Representation) encoding format for serializing and deserializing data.
func NewCBorCustomEncoder ¶
func NewCBorCustomEncoder(encOpts cbor.EncOptions) *CBorEncoder
NewCBorCustomEncoder creates and returns a new instance of CBorEncoder with custom encoding options passed as an argument.
func NewCBorEncoder ¶
func NewCBorEncoder() *CBorEncoder
NewCBorEncoder creates and returns a new instance of CBorEncoder with default encoding options (unsorted keys).
type Encoder ¶
type Encoder interface { // Marshal encodes a Go value into a byte slice (e.g., JSON, CBOR, etc.). Marshal(value any) ([]byte, error) // Unmarshal decodes a byte slice into a Go value (e.g., JSON, CBOR, etc.). Unmarshal(data []byte, value any) error }
Encoder defines the interface for types that handle encoding and decoding of data.
type GobEncoder ¶
type GobEncoder struct { }
GobEncoder is a concrete implementation of the Encoder interface that uses the Gob encoding format for serializing and deserializing data.
func NewGobEncoder ¶
func NewGobEncoder() *GobEncoder
NewGobEncoder creates and returns a new instance of GobEncoder.
type JsonEncoder ¶
type JsonEncoder struct{}
JsonEncoder implements the Encoder interface for encoding and decoding data in JSON format.
func NewJsonEncoder ¶
func NewJsonEncoder() *JsonEncoder
NewJsonEncoder creates and returns a new instance of JsonEncoder.