Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StreamCategory Definition for global EventStore interface #146

Open
alex-laycalvert opened this issue Dec 12, 2024 · 3 comments
Open

StreamCategory Definition for global EventStore interface #146

alex-laycalvert opened this issue Dec 12, 2024 · 3 comments
Labels

Comments

@alex-laycalvert
Copy link
Collaborator

What are your thoughts on adding StreamType or StreamCategory to the main EventStore interface? In the mongo impl. I also have StreamName but force the implementations to have a bit more structure. Maybe StreamName could also be a generic along with StreamType that defaults to string but could be overrided by the person creating to ES impl.

export interface EventStore<...metadataType,
    StreamCategory extends string = string,
    StreamName extends string = string
>

//... stream functions
readStream(streamName: StreamName) { ... }
@alex-laycalvert
Copy link
Collaborator Author

Would be useful to get TS inference for when attempting to use the event store functions if you already have a set list of categories.

@alex-laycalvert alex-laycalvert changed the title StreamType Definition for global EventStore interface StreamCategory Definition for global EventStore interface Dec 12, 2024
@alex-laycalvert
Copy link
Collaborator Author

Open to whatever naming convetions ESDB uses or whatever is most common

@oskardudycz
Copy link
Collaborator

@alex-laycalvert yes, we should support the formal definition for urn based and other stream names, event types (and possibly others). The stream name will need to be different for event stores, as ESDB has dash splitting the category from the stream id, so we would need to make this a param to event store definition with the default one. See https://github.com/oskardudycz/EventSourcing.NetCore/blob/cf425a4607981139f21a6dd05809801a94dc1940/Core/Events/StreamNameMapper.cs#L36

We can start from such way, but we need to keep in mind that each stream type can have a different stream id schema. Articles showing the key definition strategies:https://www.kurrent.io/blog/keep-your-streams-short-temporal-modelling-for-fast-reads-and-optimal-data-retention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants