Recent

Author Topic: UUIDv7 library and demo  (Read 165 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 16928
  • Ceterum censeo Trump esse delendam
UUIDv7 library and demo
« on: April 28, 2025, 11:23:10 am »
I have written a small, cross-platform, fully rfc compliant implementation for the UUIDv7 time sortable UUID format. This is an increasingly important UUID format and used in many distributed database applications. E.g. Amazon and PostGreSQL support it through TLE's

Includes a demo and a library with lots of documentation.
Example output:
Code: [Select]
Original time: 2025-04-28 09:25:25.303
Generated UUID: {01967BB7-30B8-747A-9F53-08EBCA9659CD}
Is valid UUIDv7?: TRUE
Extracted time: 2025-04-28 09:25:25.304
Difference (ms): 1

Generated UUID: {01967BB7-30B9-706F-B8F9-C8716A81A18A}
Is valid UUIDv7?: TRUE
Extracted time: 2025-04-28 09:25:25.305
Difference (ms): 2

Generated UUID: {01967BB7-30BA-7861-9532-AFB1574F628F}
Is valid UUIDv7?: TRUE
Extracted time: 2025-04-28 09:25:25.306
Difference (ms): 3

Note this is much smaller and validates better than some other code.
« Last Edit: April 28, 2025, 03:02:45 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

cdbc

  • Hero Member
  • *****
  • Posts: 2124
    • http://www.cdbc.dk
Re: UUIDv7 library and demo
« Reply #1 on: April 28, 2025, 11:33:04 am »
Hi Thaddy
Cool, but where is it?!?
Regards Benny

Sorry my bad flew right over the bottom...
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

Thaddy

  • Hero Member
  • *****
  • Posts: 16928
  • Ceterum censeo Trump esse delendam
Re: UUIDv7 library and demo
« Reply #2 on: April 28, 2025, 11:38:15 am »
The attachment disappeared, corrected.
I wrote it mainly because all other implementations were frustratingly over-complex and did not always validate so I reduced all handling you need to less than a 100 lines of code that does always validate.
« Last Edit: April 28, 2025, 03:03:42 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

 

TinyPortal © 2005-2018