get-eventually / eventually-rs

Event Sourcing for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postgres EventStore::SourceId type should be ToString

ar3s3ru opened this issue · comments

The EventStore::SourceId type in eventually-postgres has the following bound:

https://github.com/ar3s3ru/eventually-rs/blob/f690fe34f593e537aaeedfff2805a7591f9efa24/eventually-postgres/src/lib.rs#L164-L166

However, the aggregate_id field in the table is stored as a VARCHAR:

https://github.com/ar3s3ru/eventually-rs/blob/f690fe34f593e537aaeedfff2805a7591f9efa24/eventually-postgres/src/lib.rs#L176-L184

Given that requiring ToSql trait from the SourceId would leak an implementation detail/concern into the domain layer (which should remain impartial to the underlying storage technology adopted), the bound should instead be ToString.