Skip to main content

Scalar functions

uuid

Commentary

added in 0.0.5

Generates UUIDs values.


Examples

Generating v4 UUIDs

By default, this function will generate version 4 UUIDs.

{
"_gen": "uuid"
}
[
"ba419d35-0dfe-8af7-aee7-bbe10c45c028",
"4f083ce3-f12b-bb4b-46ee-9d82b52c856d",
"aa616abe-1761-0c9a-e743-67bd738597dc",
"5e688e99-61b3-5c88-4697-6cf7b0bfbe20",
"76b20010-c318-5754-c86c-400eff88a1e3"
]

Generating v7 UUIDs

It can also generate time-based (v7) UUIDs.

{
"_gen": "uuid",
"version": 7
}
[
"018f16f2-451f-759d-81ba-f78afe0de1bb",
"018f16f2-4520-78c0-850c-e43c084f4bbb",
"018f16f2-4521-739d-ae46-6d852cb5be6a",
"018f16f2-4522-7a0c-a117-bd6743e7dc97",
"018f16f2-4523-798e-a85e-885cb361f86c"
]

Specification

JSON schema

{
"type": "object",
"properties": {
"version": {
"type": "number",
"enum": [
4,
7
]
}
}
}