{"repo":"viascom/nanoid-postgres","free":true,"listed":false,"github":"https://github.com/viascom/nanoid-postgres","clone":"git clone https://github.com/viascom/nanoid-postgres.git","description":"Nano ID for PostgreSQL.","language":"Shell","stars":408,"topics":["nanoid","postgres","database"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"Nano ID for PostgreSQL Inspired by the following parent project: ai/nanoid A tiny, secure, URL-friendly, unique string ID generator for Postgres. “An amazing level of senseless perfectionism, which is simply impossible not to respect.” Small. Just a simple Postgres function. Safe. It uses pgcrypto random generator. Can be used in clusters. Short IDs. It uses a larger alphabet than UUID ( A-Za-z0-9 - ). So ID size was reduced from 36 to 21 symbols. Portable . Nano ID was ported to over 20 programming languages. How to use Prefixed ids The optional prefix parameter prepends a fixed marker to every generated id, so anyone looking at an id can immediately tell which entity it belongs to ( usr , ord , ...). The prefix does not count towards size : the total id length is length(prefix) + size , so size your columns accordingly (for example char(25) for the default size of 21 plus the 4-character prefix usr ). A NULL prefix behaves like an empty prefix. Using nanoid() with an existing table To make nanoid() the default of an already existing column, change the column default: This only affects future inserts. Existing rows keep their current values, and rows inserted without a value for id get a freshly generated Nano ID. See the PostgreSQL documentation on changing a column's default value for details. Getting Started Requirements PostgreSQL 9.6 or newer (the function declarations use the PARALLEL clause, which was introduced in 9.6) Execute the file nanoid.sql to create the nanoid","default_branch":null,"files":null,"tree":[],"storefront":"/r/viascom","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/viascom/nanoid-postgres/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}