oklog / ulid

Universally Unique Lexicographically Sortable Identifier (ULID) in Go
Apache License 2.0
4.51k stars 166 forks source link

Change `.Time()` method on ULID to return time.Time, add `UnixMilli` for returning ms #106

Closed tonyhb closed 1 year ago

tonyhb commented 1 year ago

It's really common to write ulid.Time(id.Time()) when using ULIDs. It would make sense for .Time() to return a time.Time, and for UnixMilli() to return the timestamp as ms. This mirrors the time package and is more ergonomic.

peterbourgon commented 1 year ago

I don't necessarily disagree, but this would represent a breaking change, which is probably a non-starter. What about adding a new method that returns time.Time, maybe Timestamp?