ThreeDotsLabs / esja

Event Sourcing library in Go.
MIT License
19 stars 4 forks source link

The Postgres implementation requires stream IDs to be valid UUID implicitly. #33

Closed krzysztofreczek closed 1 year ago

krzysztofreczek commented 1 year ago

Since we are using uuid-ossp extension in the Postgres adapter here, stream IDs that are not valid UUIDs will not be accepted.

Currently, the API does not enforce that UUID requirement which causes a bit of confusion.

Proposal: We could relax the requirement and allow users to use the ID of their choice.

@kamy22, could you please share the error you have faced when trying to use a custom stream ID?

ilkamo commented 1 year ago

Sure, this is the error: error retrieving rows for events: pq: invalid input syntax for type uuid: \"df0b5eb35fc94a9f0c41ec347793659a8304aad6\""

ilkamo commented 1 year ago

The streamID as UUID is a big limitation because sometimes a hash of something could be a good streamID and it is impossible to use it if the library forces to use only valid UUIDs.

m110 commented 1 year ago

Good point, we should rework it into varchar 👍

ilkamo commented 1 year ago

I submitted a PR: @m110 @krzysztofreczek https://github.com/ThreeDotsLabs/esja/pull/35/files

krzysztofreczek commented 1 year ago

Thanks, @kamy22, well done!

krzysztofreczek commented 1 year ago

Merged