go-eventsource

module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: MIT

README

Introduction Go Report Card Build Status on master

go-eventsource is a package for building an Event Store

The package is under development and the interfaces may change.

Event Sourcing Basics

How to use it

To create a new repository: NewRepository(store, serializer)

It has an interface for saving events and loading an aggregate.

type Repository interface {
	Save(events ...Event) (error)
	Load(id string, aggr Aggregate) (error)
}

The package comes with one serializer and two stores:

Included serializer:

  • json

Included stores:

  • dynamodb
  • memory
  • sql

If you want to add your own store or serializer, the package has these defined interfaces.

type Store interface {
	Save(record Record) error
	Load(id string) ([]Record, error)
}
type Serializer interface {
	Unmarshal(data []byte, eventType string) (Event, error)
	Marshal(event Event) ([]byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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