Skip to content
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

💡 Add ULID support #421

Open
meekstellar opened this issue Jun 28, 2023 · 5 comments
Open

💡 Add ULID support #421

meekstellar opened this issue Jun 28, 2023 · 5 comments
Assignees

Comments

@meekstellar
Copy link
Contributor

I have an idea!

Basically we use UUID for our applications, but new ULID identifier a quite bit faster and ensures that the IDs can be monotonically ordered and can be sorted even when generated within a millisecond.

Here is the ULID specs:

  • 128-bit compatibility with UUID
  • 1.21e+24 unique ULIDs per millisecond
  • Lexicographically sortable!
  • Canonically encoded as a 26 character string, as opposed to the 36 character UUID
  • Uses Crockford’s base32 for better efficiency and readability (5 bits per character)
  • Case insensitive
  • No special characters (URL safe)
  • Monotonic sort order (correctly detects and handles the same millisecond)
@meekstellar meekstellar added the type:feature New feature. label Jun 28, 2023
@meekstellar meekstellar changed the title Add ULID support💡 💡 Add ULID support Jun 28, 2023
@roxblnfk
Copy link
Member

roxblnfk commented Jun 28, 2023

FYI: We have supporting for UUID v7 in https://github.com/cycle/entity-behavior-uuid
You can read about it there https://uuid.ramsey.dev/en/stable/rfc4122/version7.html

@rauanmayemir
Copy link
Contributor

rauanmayemir commented Jun 29, 2023

I use Ulid for almost all entities PKs wrapped in ValueInterface, it works great. I'm thinking about switching to a entity-behavior, but turns out I actually like the control I have over values assignment, so I'm used to setting PKs manually.

@rauanmayemir
Copy link
Contributor

There's ought to be another plugin entity-behavior-uid that uses Symfony Uid package. 🙈 (Symfony Uid also supports Ulid among regular UUIDs)

@roxblnfk
Copy link
Member

I use Ulid for almost all entities PKs wrapped in ValueInterface, it works great. I'm thinking about switching to a entity-behavior, but turns out I actually like the control I have over values assignment, so I'm used to setting PKs manually.

The same. I prefer to generate UUID in a separated service.

@lotyp
Copy link
Member

lotyp commented Aug 17, 2023

For further clarity, I found this draft document beneficial: UUIDv6 Draft. After examining it, I suggest that ULID could be substituted with UUIDv7.
The good news is that the ramsey and cycle packages supports UUIDv7 and should cater to your requirements.

@roxblnfk roxblnfk moved this from Todo to Backlog in Cycle Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

4 participants