micronaut-projects / micronaut-data

Ahead of Time Data Repositories
Apache License 2.0
468 stars 198 forks source link

Support CUID as @AutoPopulated @Id #3228

Open goeh opened 1 week ago

goeh commented 1 week ago

Feature description

Today UUID is supported by Micronaut Data as auto generated primary keys. It would be great to also have support for CUIDs.

"CUID is a more modern approach to generating unique identifiers, designed to be more collision-resistant than UUIDs. CUIDs are shorter, making them more efficient to use in databases and easier to handle in URLs. They are also sequential to a degree, which can help with database indexing performance."

There is no CUID2 implementation i Java SDK so Micronaut would have to supply its own.

https://www.codu.co/articles/integers-uuid-guid-cuid-and-nanoid-explained-z_1mombc https://dev.to/turck/comparing-uuid-cuid-and-nanoid-a-developers-guide-50c