Skip to content
Discussion options

You must be logged in to vote

What is your use case for needed this information?

We're looking to implement an ID system similar to Stripe's where each model has a unique PK prefix.

However, we'd still like to use auto-incrementing IDs at the database level, so right now we're using hashids at the application layer to encode/decode each model's ID fields (and prepend the correct prefix). Naturally, we also need to encode/decode any FK fields for a model in other models.

Right now, are internal lib comprises of a register to keep track of all models, their PK prefixes, and their FK fields in other models. It also has an encode/decode function for transforming an object (looking at the register and encoding/decoding

M…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@lukecarr
Comment options

@austincrim
Comment options

@lukecarr
Comment options

Answer selected by jharrell
@lararosekelley
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants