Skip to content

[uuid] Create a better way to interface with gofrs uuid #53

Description

@andruwm

Background

https://pkg.go.dev/github.com/gofrs/uuid?utm_source=godoc

gofrs is used by the the event store DB Go SDK. Currently, there isn't a clean way to convert between the two types, because we have wrapped the underlying [16]byte byte array in a struct. Below is what I have currently been doing.

ID, err := gofrs.FromString(m.EventID().String())

Potential Solutions

  1. Cast the underlying byte array to the gofrs uuid then return that. Implementation would be something like follows
func (uuid UUID) GofrsUUID() gofrs.UUID
  1. Return the underlying byte array through a method so that gofrs can parse it. (this way is a little more verbose but it is cleaner
func (uuid UUID) Bytes() []byte

id, err := gofrs.FromBytes(uuid.New())

Other considerations

We will likely need a way to go gofrs uuid -> caring uuid

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions