core

package
v0.0.0-...-2723bb6 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyEntityID = EntityID("")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// Type of the action
	Type ActionType
	// EntityID of the instance in action
	EntityID EntityID
	// EntityType of the instance in action
	EntityType string
	// Previous is the instance before the action
	Previous interface{}
	// Current is the instance after the action was done
	Current interface{}
}

Action is a operation done in the model

type ActionType

type ActionType int
const (
	Create ActionType = iota
	Save
	Delete
)

type EntityID

type EntityID string

func NewEntityID

func NewEntityID() EntityID

func (EntityID) String

func (e EntityID) String() string

type Event

type Event interface {
	Body() []byte
	Time() []byte
	EntityID() EntityID
	Type() string
}

func NewNullEvent

func NewNullEvent(t time.Time) Event

type EventCodec

type EventCodec interface {
	// Reduce applies generated events into state
	Reduce(e Event, datastore ds.Datastore, baseKey ds.Key) error
	// Create corresponding events to be dispatched
	Create(ops []Action) ([]Event, error)
}

Jump to

Keyboard shortcuts

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