MCPcopy Index your code
hub / github.com/aneshas/eventstore

github.com/aneshas/eventstore @v1.5.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.2 ↗ · + Follow
210 symbols 645 edges 25 files 93 documented · 44%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Go EventStore

Go Coverage Status Go Report Card

Embeddable SQL EventStore + Aggregate Abstraction written in Go using gorm as an underlying persistence mechanism meaning - it will work with almost (tested sqlite and postgres) whatever underlying database gorm will support (just use the respective gorm driver - sqlite and postgres provided).

It is also equiped with a fault-tolerant projection system that can be used to build read models for testing purposes and is also ready for production workloads in combination with Ambar.cloud using the provided ambar package.

Features

  • Appending (saving) events to a particular stream
  • Reading events from the stream
  • Reading all events
  • Subscribing (streaming) all events from the event store (real-time - polling)
  • Aggregate root abstraction to manage rehydration and event application
  • Generic aggregate store implementation used to read and save aggregates (events)
  • Fault-tolerant projection system (Projector) which can be used to build read models for testing purposes
  • Ambar.cloud data destination (projection) integration for production projection workloads - see example

Example

I provided a simple example that showcases basic usage with sqlite, or check out cqrs clinic example

Extension points exported contracts — how you extend this code

EventStreamer (Interface)
EventStreamer represents an event stream that can be subscribed to This package offers EventStore as EventStreamer imple [2 …
projection.go
Encoder (Interface)
Encoder is used by the event store in order to correctly marshal and unmarshal event types [2 implementers]
eventstore.go
Decoder (Interface)
Decoder is an interface for decoding events [2 implementers]
ambar/ambar.go
Projector (Interface)
Projector is an interface for projecting events [2 implementers]
ambar/echoambar/echo.go
EventStore (Interface)
EventStore represents event store [2 implementers]
aggregate/store.go
Executor (FuncType)
Executor is a helper function to load an aggregate from the store, execute a function and save the aggregate back to the
aggregate/executor.go
Rooter (Interface)
Rooter represents an aggregate root interface
aggregate/root.go
Projection (FuncType)
Projection is basically a function which needs to handle a stored event. It will be called for each event that comes in
projection.go

Core symbols most depended-on inside this repo

AppendStream
called by 14
aggregate/store.go
NewJSONEncoder
called by 13
json_encoder.go
Apply
called by 10
aggregate/root.go
Run
called by 9
projection.go
Close
called by 9
eventstore.go
Rehydrate
called by 9
aggregate/root.go
Add
called by 8
projection.go
StringID
called by 8
aggregate/root.go

Shape

Function 90
Method 64
Struct 43
Interface 6
FuncType 5
TypeAlias 2

Languages

Go100%

Modules by API surface

eventstore.go27 symbols
eventstore_test.go26 symbols
aggregate/root_test.go22 symbols
aggregate/root.go18 symbols
aggregate/store_test.go14 symbols
aggregate/store.go13 symbols
projection.go10 symbols
example/cmd/api/main.go9 symbols
projection_test.go8 symbols
ambar/ambar.go8 symbols
example/account/account.go7 symbols
ambar/echoambar/echo_test.go7 symbols

For agents

$ claude mcp add eventstore \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page