Documentation
¶
Overview ¶
Package codec provides message encoding/decoding for the wt framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CBOR ¶
type CBOR struct{}
CBOR is a lightweight CBOR (Concise Binary Object Representation) codec. Implements RFC 8949 major types for basic Go types. For full CBOR support, use a dedicated library like github.com/fxamacker/cbor/v2.
type Codec ¶
type Codec interface {
// Marshal encodes a value into bytes.
Marshal(v any) ([]byte, error)
// Unmarshal decodes bytes into a value.
Unmarshal(data []byte, v any) error
// Name returns the codec name (e.g., "json", "protobuf").
Name() string
}
Codec defines the interface for message serialization.
type MsgPack ¶
type MsgPack struct{}
MsgPack is a lightweight MessagePack codec. It supports basic types: string, int, float, bool, nil, []byte, slices, maps, and structs. For production use with complex types, consider importing a full msgpack library.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds named codecs.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a Registry with JSON as the default.
func (*Registry) SetDefault ¶
SetDefault sets the default codec by name.