Skip to content

Add native uuid type to ThingsDB - #457

Open
joente wants to merge 9 commits into
mainfrom
uuid
Open

joente wants to merge 9 commits into
mainfrom
uuid

Conversation

@joente

@joente joente commented Sep 16, 2026

Copy link
Copy Markdown
Member

Description

Adds the uuid native type to ThingsDB for making it easier to work with UUID's.
The implementation for creating new UUID's is using v7 UUID's, keeping the benefit of ordering and fast to generate.

  • uuid() -> New UUID (v7)
  • uuid(<string>) -> Converts a string to UUID (both lower and upper case allowed, with and without dashes)
  • uuid(<bytes>) -> Converts (16) raw bytes to UUID
  • str(uuid) -> Returns a lowercase string representation with dashes (equal to output, client json/msgpack)
  • bytes(uuid) -> Returns a 16 byte representation of the UUID

Note: we could opt for returning the UUID as bytes to the client, but this would make it harder to work with and no direct compatibility with JSON.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Added a uuid test.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes

@joente joente self-assigned this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant