For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/system/uuid_v7.md.

uuid_v7

Generates a time-ordered UUID version 7 string (RFC 9562). UUID v7 combines a Unix millisecond timestamp with random entropy, preventing B-Tree index fragmentation and page thrashing in database primary keys.

Signature

uuid_v7() -> string

Parameters

ParameterTypeRequiredDescription
NoneNo parameters

Return value

Returns the documented result for the function signature.

Example

sql "create_order" {
  connection = connection.postgres.main
  query = "INSERT INTO orders (id, user_id, amount) VALUES (@id, @user_id, @amount) RETURNING id"
  args = { id = uuid_v7(), user_id = ctx.request.body.user_id, amount = ctx.request.body.amount }
}