News for hackers. Stuff that matters.
Re:You'll regret using natural keys by Merad on Wednesday June 05, 2024 @09:48PM (#40592593)
I'd recommend using Crockford base 32 [0] to encode the bytes. It makes the text more human friendly by eliminating case sensitivity, removing similar/ambiguous letters, and preventing accidental profanity.

And in most cases I think you're also better off just using a uuid and encoding its bytes as base 32, in which case you're basically doing type id's [1]. If the "slug" portion of the id actually encodes a uuid, then it gives you the option to store it in your database using an appropriate uuid type. This will make your database much happier than using long string PK's.

0: https://www.crockford.com/base32.html

1: https://github.com/jetify-com/typeid

There are no comments on this comment yet.