Skip to content

Commit

Permalink
doc: completes usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
jasseem committed Apr 9, 2024
1 parent 552edbf commit cccc9ea
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ This Go Event Sourcing Library offers a broad range of features to make implemen

These features come together to provide a solid foundation for implementing the Event Sourcing pattern in your Go applications, facilitating efficient data change handling and thorough auditing of changes over time.

Certainly! Here's a completed section that references the to-do list example as a practical illustration of how to use the event sourcing library:

## Usage

To use this library, you would define your own aggregate states and event states that satisfy the `AggregateState` and `EventState` interfaces, respectively. Then, you can create events and apply them to aggregates, and store the aggregates in an event store.

### Usage Examples

For a hands-on illustration of how to apply this library, check out our to-do list example. This repository demonstrates a simple yet effective implementation of event sourcing in a practical application: managing a to-do list. You'll see how aggregate and event states are defined and utilized within a Go application, providing a clear blueprint for incorporating event sourcing into your projects.

- **Example Repository**: [Event Sourcing To-Do Example](https://github.com/thefabric-io/eventsourcing.example)

In this example, you will learn how to:

- Define aggregate states for your to-do items and event states for actions such as creating a to-do or adding a task.
- Create and apply events to these aggregates, effectively demonstrating the event sourcing process.
- Utilize the Command Query Responsibility Segregation (CQRS) pattern to separate the read and write operations of your application, enhancing its architecture and scalability.

This example serves as a practical guide to understanding and implementing event sourcing with our library. By exploring the repository, you can gain insights into structuring your application for event sourcing and managing state through events in a real-world scenario.

## Main Components

### Aggregate
Expand Down Expand Up @@ -144,13 +164,6 @@ This implementation allows `UserState` to explicitly specify `user_table` as its
- This interface is optional; you can choose to implement it based on your project's requirements.
- Ensure consistency in the naming conventions used across your project for clarity.


## Usage

To use this library, you would define your own aggregate states and event states that satisfy the `AggregateState` and `EventState` interfaces, respectively. Then, you can create events and apply them to aggregates, and store the aggregates in an event store.

**WIP, TODO: Add usage examples**

## PostgreSQL Event Store Implementation

The Go Event Sourcing Library includes a PostgreSQL implementation of the Event Store interface. This provides the ability to persist and query your events in a PostgreSQL database, giving you the ability to leverage robust and scalable SQL database capabilities for your Event Sourcing needs.
Expand Down

0 comments on commit cccc9ea

Please sign in to comment.