-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: generate IDs in the same format as UUID #2
Comments
Ok, thanks for the suggestion! Originally the My use-case has been mostly with mariadb in which a monotonic id is persisted as a binary type. The original UUID format is still accessible via the All that being said and now looking back I can see how the documentation and interface can be confusing. Here is an example of monotonic id with the sample above:
Now without providing a mid as a parameter (created from new UUID):
Changing the interface is going to be a breaking Thoughts? |
I'd say that |
The I believe I understand your use-case now. You would like to have the string version of the modified UUID ordered to be monotonically increasing which you can get with Would persisting your monotonic-ids as binary types be an option for you? |
That's the case. Saving result of
Not really. I'd like to use string version of monotonic-id. It's easier to use and works perfectly fine with Postgres UUID field types. I think it would be nice to format output of
Agreed. Maybe |
toID()
method sorts generated id and returns it in a non-uuid format (eg.11e7-a9d1-48fb57a0-bcd7-81ecee726a36
).Once its saved in Postgres
UUID
column Postgres will re-format this value into UUID canonical representation (11e7a9d1-48fb-57a0-bcd7-81ecee726a36
).In terms of Postgres it doesn't matter in which format the uuid will be passed. It will accept both of them.
However, this can be a problem when generated id is used both in a Postgres DB and different storage (in my case it is Mongo).
What I'd like to suggest is to change the format of the id generated by
toID()
to be exact as UUID canonical representation.The text was updated successfully, but these errors were encountered: