-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve createulid * Update input1.md
- Loading branch information
Showing
5 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
docs/03.reference/01.functions/createulid/_arguments/input1.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```luceescript+trycf | ||
loop times=3 { | ||
dump( createULID() ); | ||
} | ||
loop times=3 { | ||
dump( createUUID() ); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
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 |