diff --git a/pages/querying/functions.mdx b/pages/querying/functions.mdx index 08cf8e118..dc8851256 100644 --- a/pages/querying/functions.mdx +++ b/pages/querying/functions.mdx @@ -63,6 +63,13 @@ This section contains the list of supported functions. | `timestamp` | `timestamp() -> (integer)` | Returns the difference, measured in microseconds, between the current time and midnight, January 1, 1970 UTC. | | `valueType` | `valueType(any) -> (string)` | Returns the value type of the object provided in textual format. | +### Auth functions + + | Name | Signature | Description | + | --------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | `username` | `username() -> (string)` | Returns the username of the current user. Returns `null` if no user is authenticated or if the user has no username. In triggers, returns the username of the user who invoked the trigger. | + | `roles` | `roles(db_name?: string) -> (List[string])` | Returns a list of role names assigned to the current user. The `db_name` parameter is optional. If provided, returns only roles assigned for that specific database. If omitted, returns all roles assigned to the user across all databases. Returns an empty list if no user is authenticated or if the user has no roles. In triggers, returns the roles of the user who invoked the trigger. | + ### Pattern functions | Name | Signature | Description | | --------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |