event

package
v0.0.0-...-5fa8032 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInputData = errors.New("event: invalid data input for codec")
	ErrCodecNotFound    = errors.New("event: codec not found")
)

Functions

func Encode

func Encode(e *Event) ([]byte, error)

func RegisterCodec

func RegisterCodec(event string, cc codec.Codec)

func RegisterCodecs

func RegisterCodecs(events map[string]codec.Codec)

Types

type Codec

type Codec struct {
	// contains filtered or unexported fields
}

func NewCodec

func NewCodec() *Codec

func (*Codec) Decode

func (c *Codec) Decode(data []byte) (*Event, error)

func (*Codec) Encode

func (c *Codec) Encode(e *Event) ([]byte, error)

func (*Codec) Register

func (c *Codec) Register(event string, cc codec.Codec)

func (*Codec) RegisterMap

func (c *Codec) RegisterMap(commands map[string]codec.Codec)

type Encoding

type Encoding interface {
	Decode([]byte) (*Event, error)
	Encode(*Event) ([]byte, error)
}

type Event

type Event struct {
	// contains filtered or unexported fields
}

func Decode

func Decode(data []byte) (*Event, error)

func New

func New(
	name string,
	streamName string,
	streamID uuid.UUID,
	version int,
	payload codec.Codec,
) *Event

func (*Event) ID

func (e *Event) ID() uuid.UUID

func (*Event) Name

func (e *Event) Name() string

func (*Event) Payload

func (e *Event) Payload() codec.Codec

func (*Event) StreamID

func (e *Event) StreamID() uuid.UUID

func (*Event) StreamName

func (e *Event) StreamName() string

func (*Event) String

func (e *Event) String() string

func (*Event) Unix

func (e *Event) Unix() int64

func (*Event) Version

func (e *Event) Version() int

Jump to

Keyboard shortcuts

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