VADOSWARE / pg_idkit

Postgres extension for generating UUIDs
https://vadosware.io/post/introducing-pg-idkit/
Apache License 2.0
360 stars 8 forks source link

Feature: add ability to extract timestamps #7

Closed t3hmrman closed 10 months ago

t3hmrman commented 2 years ago

Context

Some UUIDs have time components embedded in them that can be extracted.

While not ever UUID generation mechanism can return a native type like uuid, it should be clear which type the function is returning.

Proposal

Given a text value that has been generated by pg_idkit with a function like idkit_<mechanism>_generate (or a similar function), there should be a function idkit_<mechanism>_extract_timestamptz_from_<type>

For example:

Alternatives

N/A

Additional Links

N/A

t3hmrman commented 11 months ago

Implemented for cuid (despite cuid being deprecated in favor of cuid2) in https://github.com/VADOSWARE/pg_idkit/commit/e10879b0cade592d8ad89fac709e0c07f049a978

t3hmrman commented 10 months ago

UUID v7 handled in https://github.com/VADOSWARE/pg_idkit/pull/38

UUID v6 handled in https://github.com/VADOSWARE/pg_idkit/pull/37

t3hmrman commented 10 months ago

PushID is not implemented, but as it depends on some upstream code (a branch makes with some WIP changes), I'm going to add a stretch goal to add support for it.