Skip to content

sycertech/pksuid

Repository files navigation

pksuid

An extension for PostgreSQL providing a type and generation function for Prefixed KSUIDs, similar to that of Clerk and Stripe

Example

postgres=# create extension prefixed_ksuid;
create extension

postgres=# select pksuid_generate('client');
       pksuid_generate
------------------------------------
 client_2a40rvcCfXqllp2pWTNr6sH2wns

postgres=#
postgres=#
postgres=# create table if not exists client(
    id pksuid primary key default pksuid_generate('client'),
    name text
);
postgres=# insert into client(name) values('Dave');
INSERT 0 1
postgres=# select * from client;
                 id                 | name
------------------------------------+------
 client_2a48v6M9BKq9nBN5MkOREN1YTsl | Dave
(1 row)

Roadmap

  • pgrx plugin
  • sqlx type

About

prefixed ksuids for postgresql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages