oklog / ulid

Universally Unique Lexicographically Sortable Identifier (ULID) in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

tonyhb opened this issue · comments

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.

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?