diff --git a/docs/03.reference/01.functions/createulid/_arguments/input1.md b/docs/03.reference/01.functions/createulid/_arguments/input1.md index fa1b98b4b..908c30c75 100644 --- a/docs/03.reference/01.functions/createulid/_arguments/input1.md +++ b/docs/03.reference/01.functions/createulid/_arguments/input1.md @@ -1 +1,3 @@ -Used in conjunction with the 'hash' type, this numeric input contributes to the generation of a deterministic ULID by influencing its random component. \ No newline at end of file +Used in conjunction with the `hash` type, this numeric input contributes to the generation of a deterministic ULID by influencing its random component. + +only used for hash \ No newline at end of file diff --git a/docs/03.reference/01.functions/createulid/_arguments/input2.md b/docs/03.reference/01.functions/createulid/_arguments/input2.md index 501d407a5..9957dddb5 100644 --- a/docs/03.reference/01.functions/createulid/_arguments/input2.md +++ b/docs/03.reference/01.functions/createulid/_arguments/input2.md @@ -1 +1 @@ -Similar to 'input1', this string input is utilized only in the 'hash' mode to further seed the ULID's random component, enabling the creation of a deterministic ULID based on the hash of the inputs. \ No newline at end of file +Similar to `input1`, this string input is utilized only in the `hash` mode to further seed the ULID's random component, enabling the creation of a deterministic ULID based on the hash of the inputs. \ No newline at end of file diff --git a/docs/03.reference/01.functions/createulid/_arguments/type.md b/docs/03.reference/01.functions/createulid/_arguments/type.md index 5b3ab4f0f..f87061937 100644 --- a/docs/03.reference/01.functions/createulid/_arguments/type.md +++ b/docs/03.reference/01.functions/createulid/_arguments/type.md @@ -1 +1,4 @@ -Specifies the generation mode of the ULID. If not defined, a standard ULID is generated. 'monotonic' ensures ULIDs increase monotonically, suitable for ensuring order in rapid generation scenarios. 'hash' mode generates a ULID based on hashing the provided inputs, useful for creating deterministic identifiers. \ No newline at end of file +Specifies the generation mode of the ULID. If not defined, a standard ULID is generated. + +- `monotonic` ensures ULIDs increase monotonically, suitable for ensuring order in rapid generation scenarios. +- `hash` mode generates a ULID based on hashing the provided inputs, useful for creating deterministic identifiers. \ No newline at end of file diff --git a/docs/03.reference/01.functions/createulid/_examples.md b/docs/03.reference/01.functions/createulid/_examples.md new file mode 100644 index 000000000..8c9085829 --- /dev/null +++ b/docs/03.reference/01.functions/createulid/_examples.md @@ -0,0 +1,9 @@ +```luceescript+trycf +loop times=3 { + dump( createULID() ); +} + +loop times=3 { + dump( createUUID() ); +} +``` diff --git a/docs/03.reference/01.functions/createulid/function.md b/docs/03.reference/01.functions/createulid/function.md index 5c9030271..c70dcefb4 100644 --- a/docs/03.reference/01.functions/createulid/function.md +++ b/docs/03.reference/01.functions/createulid/function.md @@ -1,8 +1,20 @@ --- title: createULID id: function-createulid +description: Generates a ULID (Universally Unique Lexicographically Sortable Identifier) related: -categories: +- function-createguid +- function-createuuid --- -Generates a ULID (Universally Unique Lexicographically Sortable Identifier), a 128-bit identifier where the first 48 bits are a timestamp representing milliseconds since the Unix Epoch (1970-01-01), ensuring temporal ordering. The remaining 80 bits are populated by a secure random number generator, contributing to the identifier's uniqueness. The output is a 26-character string in its canonical representation. This function can operate in three modes specified by the 'type' argument: 'empty' for standard ULID generation, 'monotonic' to ensure sequential IDs even in rapid succession, and 'hash' to generate a ULID based on hashed input values. \ No newline at end of file +Generates a ULID (Universally Unique Lexicographically Sortable Identifier), a 128-bit identifier where the first 48 bits are a timestamp representing milliseconds since the Unix Epoch (1970-01-01), ensuring temporal ordering. + +The remaining 80 bits are populated by a secure random number generator, contributing to the identifier's uniqueness. The output is a 26-character string in its canonical representation. + +This function can operate in three modes specified by the 'type' argument: + +- `empty` for standard ULID generation +- `monotonic` to ensure sequential IDs even in rapid succession +- and `hash` to generate a ULID based on hashed input values. + +ULIDs are better for insert performance, as they don't create sparse B-Tree indexes like UUIDs, saving disk space