I’m working with loosely coupled services and databases that rely on UUIDv4 as their primary keys. Ecto supports this very easily out of the box. No more auto-incrementing keys! One of the really nice advantages is that each UUID is unique throughout the entire system, no matter which table or database it is in. However, I’m wondering how we might implement something even better: how can we add a short prefix to each key to help humans identify each key without having to go on a wild goose-chase to determine its source. I’m thinking something like Stripe’s API, where each resource has an id like cus_ab134axcvasf
or tok_hg212fasdf
so it’s clear at a glance the resources being referred to are users or tokens respectively.
I feel like this might be pushing too much against the grain of what’s possible with PostGres. Has anyone implemented something like this? Any pointers?
Thanks!