codec

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventType is a the type for Event.
	EventType eh.EventType = "CodecEvent"
	// AggregateType is the type for Aggregate.
	AggregateType eh.AggregateType = "CodecAggregate"
	// CommandType is the type for Command.
	CommandType eh.CommandType = "CodecCommand"
)

Variables

This section is empty.

Functions

func CommandCodecAcceptanceTest added in v0.15.0

func CommandCodecAcceptanceTest(t *testing.T, c eh.CommandCodec, expectedBytes []byte)

CommandCodecAcceptanceTest is the acceptance test that all implementations of CommandCodec should pass. It should manually be called from a test case in each implementation:

func TestCommandCodec(t *testing.T) {
    c := CommandCodec{}
    expectedBytes = []byte("")
    codec.CommandCodecAcceptanceTest(t, c, expectedBytes)
}

func EventCodecAcceptanceTest

func EventCodecAcceptanceTest(t *testing.T, c eh.EventCodec, expectedBytes []byte)

EventCodecAcceptanceTest is the acceptance test that all implementations of EventCodec should pass. It should manually be called from a test case in each implementation:

func TestEventCodec(t *testing.T) {
    c := EventCodec{}
    expectedBytes = []byte("")
    codec.EventCodecAcceptanceTest(t, c, expectedBytes)
}

Types

type Command added in v0.15.0

type Command struct {
	ID         uuid.UUID
	Bool       bool
	String     string
	Number     float64
	Slice      []string
	Map        map[string]interface{}
	Time       time.Time
	TimeRef    *time.Time
	NullTime   *time.Time
	Struct     Nested
	StructRef  *Nested
	NullStruct *Nested
}

Command is a mocked eventhorizon.Command, useful in testing.

func (*Command) AggregateID added in v0.15.0

func (t *Command) AggregateID() uuid.UUID

func (*Command) AggregateType added in v0.15.0

func (t *Command) AggregateType() eh.AggregateType

func (*Command) CommandType added in v0.15.0

func (t *Command) CommandType() eh.CommandType

type EventData

type EventData struct {
	Bool       bool
	String     string
	Number     float64
	Slice      []string
	Map        map[string]interface{}
	Time       time.Time
	TimeRef    *time.Time
	NullTime   *time.Time
	Struct     Nested
	StructRef  *Nested
	NullStruct *Nested
}

EventData is a mocked event data, useful in testing.

type Nested

type Nested struct {
	Bool   bool
	String string
	Number float64
}

Nested is nested event data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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