encoding

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coder

type Coder interface {
	KeyCoder
	ValueCoder
}

Encoder / Decoder interface

func NewCoder

func NewCoder(opts ...CoderOpts) Coder

type CoderOpts

type CoderOpts func(*CoderPair)

type CoderPair added in v0.1.1

type CoderPair struct {
	KeyCoder
	ValueCoder
}

func (CoderPair) DecodeValue added in v0.1.1

func (c CoderPair) DecodeValue(data []byte, val any) error

func (CoderPair) EncodeValue added in v0.1.1

func (c CoderPair) EncodeValue(val any) ([]byte, error)

type Constants

type Constants struct {
	Delimiter      string
	TransactionKey string
	BucketKey      [2]string // Leading and trailing delimiters
}

type CustomValueDecoder

type CustomValueDecoder interface {
	DecodeValue(coder ValueCoder, data []byte) error
}

Interface for custom DecodeValue implementation

type CustomValueEncoder

type CustomValueEncoder interface {
	EncodeValue(coder ValueCoder) ([]byte, error)
}

Interface for custom EncodeValue implementation

type KeyCoder

type KeyCoder interface {
	// Returns struct with all coder constants
	Symbols() Constants

	EncodeKey(key ...string) string
	DecodeKey(key string) []string

	EncodeBucket(key ...string) string
	DecodeBucket(bucket ...string) []string
}

type ValueCoder

type ValueCoder interface {
	EncodeValue(val any) ([]byte, error)
	DecodeValue(data []byte, val any) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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