Session functions
These functions return information about the current SurrealDB session.
| Function | Description |
|---|---|
session::ac() | Returns the current user's access method |
session::db() | Returns the currently selected database |
session::id() | Returns the current user's session ID |
session::ip() | Returns the current user's session IP address |
session::ns() | Returns the currently selected namespace |
session::origin() | Returns the current user's HTTP origin |
session::rd() | Returns the current user's record authentication data |
session::token() | Returns the current user's authentication token |
session::ac
Note
The session::ac function returns the current user's access method.
The following example shows this function, and its output, when used in a RETURN statement:
session::db
The session::db function returns the currently selected database.
The following example shows this function, and its output, when used in a RETURN statement:
session::id
The session::id function returns the current user's session ID.
The following example shows this function, and its output, when used in a RETURN statement:
session::ip
The session::ip function returns the current user's session IP address.
The following example shows this function, and its output, when used in a RETURN statement:
session::ns
The session::ns function returns the currently selected namespace.
The following example shows this function, and its output, when used in a RETURN statement:
session::origin
The session::origin function returns the current user's HTTP origin.
The following example shows this function, and its output, when used in a RETURN statement:
session::rd
The session::rd function returns the current user's record authentication.
session::token
The session::token function returns the current authentication token.