Open zelark opened 4 years ago
We're using Datomic which supports a uuid type. We expose this uuid as a public id to some resources. I'd be happy to switch to nano-id if I knew what the lookup cost is, if any, in switching to string comparisons. Honestly, I have no clue how Datomic handles uuid lookups. Perhaps these are string comparisons under the hood too?
@carrete it's a good question, but unfortunately I'm slightly familiar with Datomic. I've just read about its indexing mechanism and I think I can give you a valid answer, but first I'd like to know what UUID generator you use — is it Peer.squuid
or true randomUUID
?
They recommend to use Peer.squuid
because it will give you a better indexing:
https://docs.datomic.com/on-prem/identity.html#org09032a7
As I understand, in general, it’s better if you can manage to put monotonically increasing values for unique Identities.
We use randomUUID
, though simply out of convenience. There's no reason why we would have to stick with randomUUID
.
In that link, I see it says:
Datomic's indexes are optimized to gracefully handle all UUIDs, so Squuids are not strictly necessary. However, you should still prefer Squuids if your ids may ever be indexed in other, non-Datomic systems.
We don't ever plan to index our ids in other, non-Datomic systems. This is not a requirement we have. FYI
Then I think it won't be differ that much. Anyway, I asked the question in slack https://clojurians-log.clojureverse.org/datomic/2020-05-08/1588924450.320800
Thanks @zelark !
I’m using it for a not yet publicly released (I’ll edit this comment with a name/link once its public, if I remember) cryptocurrency trade automation service (a “bring your own signals” hosted trading bot). I use nanoid for generating tokens for any user shareable things and referral tokens, as a more visually compact alternative to UUID’s.
I really like this library, its small, simple and to the point. Thanks for creating it!
Hi there, we're using it on https://paper.li/ . We recently launched a feature allowing users to write their own stories (kind of blog posts), and to uniquely identifies those stories across our system we use nano-id.
Very cool library :+1:
I'm using it in my little custom blog software. http://fossil.calmabiding.me/mylife
Finding it very useful.
Since new 1.0.0 version is going out soon, I wonder who's using nano-id? So if you use it in prod or just for hobby project, please drop a message below. I'd like to add a list to readme.
Also you might consider to start using it once 1.0.0 is released. ٩(◕‿◕。)۶
UPD: nano-id 1.0.0 was released. Give it a try.