ULIDs support null ULID & store ULID as string to DB.
By default, the ulid.ULID
from github.com/oklog/ulid is stored as binary, and it is hard to query it in DBMS, that's why I make this little helper that wraped the original ulid.ULID
to store it as string to DB. Also, I'd like to avoid pointer in struct if possible, insipred by the github.com/guregu/null library, I added a Null
type that can store ulid.ULID
as NULL
in DB and also supported null JSON
.
go get github.com/fahmifan/ulids
Usage example can be found here