eventcodec

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	// Decode decodes data and stores the result in out.
	Decode(data, out interface{}) error

	// Encode encodes in and stores the result in data.
	Encode(in interface{}) (data interface{}, err error)
}

Codec is a codec (encoder and decoder) for an event.

type Codecs

type Codecs interface {
	EncodeDecoder(name string) Codec
}

type DefaultCodecs

type DefaultCodecs struct {
	Codecs map[string]Codec
	// contains filtered or unexported fields
}

func NewDefaultCodecs

func NewDefaultCodecs(d Codec, namedCodecs ...NamedCodec) *DefaultCodecs

func (*DefaultCodecs) EncodeDecoder

func (dc *DefaultCodecs) EncodeDecoder(name string) Codec

type JSON

type JSON struct{}

func (JSON) Decode

func (j JSON) Decode(data, out interface{}) error

func (JSON) Encode

func (j JSON) Encode(in interface{}) (interface{}, error)

type NamedCodec

type NamedCodec struct {
	Name  string
	Codec Codec
}

NamedCodec holds a codec and its corresponding operation name.

func Op

func Op(name string, codec Codec) NamedCodec

Op is a shortcut for creating an instance of NamedCodec.

Jump to

Keyboard shortcuts

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