You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/functions_for_text.md
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -153,8 +153,43 @@ Please note all keys and values in the returned map are in string type. You can
153
153
154
154
### uuid
155
155
156
+
Alias of [generate_uuidv4](#generate_uuidv4).
157
+
156
158
`uuid()` or `uuid(x)` Generates a universally unique identifier (UUIDv4) which is a 16-byte number used to identify records. In order to generate multiple UUID in one row, pass a parameter in each function call, such as `SELECT uuid(1) as a, uuid(2) as b` Otherwise if there is no parameter while calling multiple `uuid` functions in one SQL statement, the same UUID value will be returned.
157
159
160
+
### generate_uuidv4
161
+
162
+
Generates a universally unique identifier (UUIDv4) which is a 16-byte number used to identify records.
163
+
164
+
### generate_uuidv7
165
+
166
+
`generate_uuidv7()` Generates a universally unique identifier (UUIDv7), which contains the current Unix timestamp in milliseconds (48 bits), followed by version "7" (4 bits), a counter (42 bit) to distinguish UUIDs within a millisecond (including a variant field "2", 2 bit), and a random field (32 bits). For any given timestamp (unix_ts_ms), the counter starts at a random value and is incremented by 1 for each new UUID until the timestamp changes. In case the counter overflows, the timestamp field is incremented by 1 and the counter is reset to a random new start value.
167
+
168
+
### generate_uuidv7_thread_monotonic
169
+
170
+
Generates a UUID version 7.
171
+
172
+
The generated UUID contains the current Unix timestamp in milliseconds (48 bits), as [generate_uuidv7](#generate_uuidv7) but gives no guarantee on counter monotony across different simultaneous requests.
173
+
Monotonicity within one timestamp is guaranteed only within the same thread calling this function to generate UUIDs.
174
+
175
+
### generate_uuidv7_non_monotonic
176
+
177
+
Generates a UUID version 7. This function is the fastest but it gives no monotonicity guarantees within a timestamp.
178
+
179
+
180
+
### uuid_to_num
181
+
`uuid_to_num(uuid)`
182
+
Extract bytes from a UUID and convert them to a number. The result is a 128-bit integer, which is the same as the UUID in binary format. The argument needs to be a UUIDv4 or UUIDv7, not a string. If you get a string, use `uuid_to_num(to_uuid(uuid_string))` or `uuid_string_to_num(uuid_string)`.
183
+
184
+
### uuid_string_to_num
185
+
`uuid_string_to_num(string[, variant = 1])` Accepts string containing 36 characters in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, and returns a `fixed_stringtring(16)` as its binary representation, with its format optionally specified by variant (Big-endian by default).
186
+
187
+
### uuidv7_to_datetime
188
+
`uuidv7_to_datetime(uuid [, timezone])` Returns the timestamp component of a UUID version 7.
189
+
190
+
### to_uuid
191
+
`to_uuid(string)` Converts a string in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to a UUID. The string must be 36 characters long and contain only hexadecimal digits and hyphens.
192
+
158
193
### base64_encode
159
194
160
195
`base64_encode(string)` Encodes a string or fixed_string as base64.
0 commit comments