EventStore / EventStore-Client-Go

Go Client for Event Store version 20 and above.
Apache License 2.0
105 stars 27 forks source link

Validate messages.ProposedEvent.EventID uuid internally, so that package consumers can choose their own UUID implementation #45

Closed andruwm closed 8 months ago

andruwm commented 3 years ago

Background

There are a number of other popular Go UUID libraries in existence such as https://github.com/google/uuid. Currently, if an org uses a different uuid package they must do something like

ID, err := uuid.FromString(googleuuid.New().String())
if err != nil {
    panic(err)
}

in order to interface with EventStore-Client-Go. This means an additional dependency must be added to the project for a single slim use case.

Proposal

Change the messages.ProposedEvent definition to accept a string as the EventID, then validate the input internally.

type ProposedEvent struct {
    EventID      string
    EventType    string
    ContentType  string
    Data         []byte
    UserMetadata []byte
}

My team has started to use this Go SDK in practice (we understand the API is not stable), so I'd be happy to jump in and make contributions here if needed.

YoEight commented 10 months ago

I know this ticket was open a long time ago but is it really useful for users to pick their own uuid implementation? string has a bigger memory footprint than 16 byte array. We could have a different intermediary representation but that's a lot of work for the user with no real benefit. What about just using google/uuid instead?

cdevarenne commented 9 months ago

Using google/uuid makes sense.