Recent

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

Thaddy

  • Hero Member
  • *****
  • Posts: 19386
  • Glad to be alive.
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 »
objects are fine constructs. You can even initialize them with constructors.

cdbc

  • Hero Member
  • *****
  • Posts: 2850
    • 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: 19386
  • Glad to be alive.
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 »
objects are fine constructs. You can even initialize them with constructors.

 

TinyPortal © 2005-2018