primait / event_sourcing.rs

event sourcing framework in rust
51 stars 4 forks source link

Add new generic on PgStore and converter trait to decouple persistence from Aggregate::Event #191

Closed Johnabell closed 7 months ago

Johnabell commented 7 months ago

This PR adds a way to decouple the persistence from the domain Aggregate::Event types.

This removes the need to Aggregate::Event to implement the Event trait to work with PgStore.

It simultaneously provides a way to deprecate events without the effects propagating through a code base. Furthermore it provides an alternative way to upcast events.

I have added an example to demonstrate the use case of deprecation and upcasting.