Skip to content

Demonstrate implementation of event sourced domain model in Golang

License

Notifications You must be signed in to change notification settings

0angelic0/event-sourced-domain-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demonstration of implementing Event-Sourced Domain Model with Golang

The Use Case : PetShop

The problem's domain for this project is just a very very simple PetShop

Functions

  • List all Pets
  • Add a Pet (to the shop)
  • Change a Pet's Name
  • Sell a Pet
  • Return a Pet

The Implementation

For the sake of understanding how the program was evolved, this repo show the implementation of the Use Case with these business logic implementation patterns:

  1. The Legacy
  2. Transaction Script
  3. Active Record
  4. Domain Model
  5. Event-Sourced Domain Model

The Diagrams

The UML class diagrams were generated by goplantuml and can be rendered via PlantUML

The Event Store

The implementation use RDBMS (MySQL) with JSON feature as an event store.

The Presentation

Event-Sourced Domain Model

The Makefile

Prepare Database

To run program you must start MySQL as a docker first, just docker-compose up -d will get MySQL up and running for you.

Then prep the databases and tables using scripts in sql folder.

Run the program

run legacy program

make run0

run transaction script program

make run1

run active record program

make run2

run domain model program

make run3

run event-sourced domain program

make run4

About

Demonstrate implementation of event sourced domain model in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published