Recent

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

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
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 »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

cdbc

  • Hero Member
  • *****
  • Posts: 2625
    • 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 -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
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 »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

 

TinyPortal © 2005-2018