sample

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	*goes.Aggregate
	FirstName string
	LastName  string
	Email     string
}

User defines a simple domain object that will have methods that support event sourcing.

func NewUser

func NewUser(first, last, email string) (*User, error)

NewUser instantiates an instance of User, and initializes the embedded aggregate structure.

func NewUserFromHistory

func NewUserFromHistory(events []goes.Event) *User

NewUserFromHistory instantiates a User and applies its event history to derive the current state of hte aggregate.

func (*User) Apply

func (u *User) Apply(event goes.Event)

Apply is the standard event sourcing method that routes an event then records the event in the event history

func (*User) Route

func (u *User) Route(event goes.Event)

Route is the standard method for routing events to event handlers.

func (*User) Store

func (u *User) Store(eventStore goes.EventStore) error

Store uses the event store passed to it to persistently recorded the current set of unperistent events.

func (*User) UpdateFirstName

func (u *User) UpdateFirstName(first string)

UpdateFirstName is a command handler that handles updating the user first name, generating a UserFirstNameUpdated event.

type UserCreated

type UserCreated struct {
	AggregateId string
	FirstName   string
	LastName    string
	Email       string
}

UserCreated is the event generated when a user struct is first instantiated.

type UserFirstNameUpdated

type UserFirstNameUpdated struct {
	OldFirst string
	NewFirst string
}

UserFirstNameUpdated is an event generated when the first name is updated.

type UserLastNameUpdated

type UserLastNameUpdated struct {
	OldLast string
	NewLast string
}

UserLastNameUpdated is an event generated when the last name is updated.

Directories

Path Synopsis
Package eventstore is a generated protocol buffer package.
Package eventstore is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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