-
-
Notifications
You must be signed in to change notification settings - Fork 942
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
feat(string): adds support for generating ULID #2524
feat(string): adds support for generating ULID #2524
Conversation
Update: improved the description |
Thank you for your contribution. Since this PR doesn't have a relatet issue, please understand that we might need some time to decide on the usability of this feature. Thank you for your patience. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #2524 +/- ##
=======================================
Coverage 99.96% 99.97%
=======================================
Files 2794 2796 +2
Lines 227415 227441 +26
Branches 949 956 +7
=======================================
+ Hits 227342 227377 +35
+ Misses 73 64 -9
|
Team Decision
The PR description contains a script that can be used as a workaround. |
Can we add a matching issue so it can collect upvotes? |
didn't find any issues related to this, but I would like to state my support for this feature! |
While that might be true, I would be in favor to build it differently and make use of |
Added #2648 to allow for collecting upvotes (we normally try to get 10 upvotes to indicate sufficient interest) and further promote discussion |
# Conflicts: # test/modules/__snapshots__/string.spec.ts.snap
@brunocleite Please fix the failing tests. Probably using |
…ation' into feat/adds-support-for-ulid-generation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@brunocleite FYI: This PR is ready, but is still waiting for the release of v9.0. After the release there will be a time of about 2 weeks in which we freeze updates on the |
Dear @brunocleite, Thank you for your patience and contributions so far. We wanted to provide you with a brief update. We are pleased to inform you that we have addressed all the known bugs in version 9.0. We will now take a short break and resume work around October 7, 2024, to begin merging new features for v9.1, including yours. In the meantime, we hope you have a great time, and we sincerely appreciate your ongoing support and contributions. Best regards, FYI: There is currently a merge conflict, could you please fix until then? |
…ulid-generation # Conflicts: # src/modules/date/index.ts # test/utils/__snapshots__/base32.spec.ts.snap
9646279
Thank you for the update. I'm honored to be contributing and will resolve the merge conflicts promptly. |
There is another type of unique identifier other than UUID that is called ULID Universally Unique Lexicographically Sortable Identifier.
This type of identifier has the benefit of maintaining a sortable order and is useful as primary keys on databases (mainly NoSQL) to get free date-time sorting out of the box. More information here
ULID is a 26 characters string which the first 10 characters are the timestamp as millis from the epoch and the other 16 are the randomness.
The allowed characters are from
Crockford's Base32
which excludes letters I, L, and O to avoid confusion with digits.On the code excerpt above it is using the first character as [012] because that would already generate dates up to year 5314 which is more than enough. To confirm this behavior you can go here and try using
2ZZZZZZZZZWZYF0EJ600G2SZHA
as an ULID.