gofrs / uuid

A UUID package for Go
MIT License
1.57k stars 110 forks source link

Ability to encode specific timestamp into a V1 UUID #84

Closed rkuris closed 3 weeks ago

rkuris commented 4 years ago

Hi,

I have a need to encode a specific timestamp (instead of time.Now()) into a V1 UUID. There doesn't seem to be a way to do that. Before I start coding the change for that, I'm checking to see if this is something that is generally useful or if I should just maintain my own code to do this.

Thoughts?

cameracker commented 3 years ago

This strikes me as a useful bit of functionality and wouldn't be a major expansion to the API. Maybe something like

NewV1FromTimestamp(t time.Time)

adiatma85 commented 1 year ago

Do we need a function to decode the UUID to got the specific time?

I think it's good enough to got that timestamp from UUID as well

cameracker commented 3 weeks ago

This has been closed in #142