cycle / orm

PHP DataMapper, ORM
https://cycle-orm.dev
MIT License
1.23k stars 72 forks source link

💡 Add ULID support #421

Open meekstellar opened 1 year ago

meekstellar commented 1 year ago

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:

roxblnfk commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

roxblnfk commented 1 year ago

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 commented 1 year ago

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.