Current values are bare-keyword expressions that return information about the current session or the current moment in time.
GQLRETURN CURRENT_USER, CURRENT_GRAPH, CURRENT_TIMESTAMP
In the ISO GQL standard these are classified as general value specifications (ISO/IEC 39075 §22.20). The keywords are reserved, so they cannot be used as variable, label, or property names.
Keyword | Category | Returns |
|---|---|---|
CURRENT_USER | Session | A record describing the authenticated user, or NULL |
CURRENT_GRAPH | Session | The active graph name as STRING, or NULL |
CURRENT_DATE | Temporal | Current date as DATE |
CURRENT_TIME | Temporal | Current time with timezone as ZONED TIME |
CURRENT_TIMESTAMP | Temporal | Current datetime with timezone as ZONED DATETIME |
LOCAL_TIME | Temporal | Current time without timezone as LOCAL TIME |
LOCAL_TIMESTAMP | Temporal | Current datetime without timezone as LOCAL DATETIME |
Returns a record describing the authenticated user for the current request. Returns NULL when no user is authenticated (for example, when the server is running with access control disabled).
| Syntax | CURRENT_USER |
| Return Type | RECORD or NULL |
| Record Fields |
username (STRING): the user's login nameroles (LIST<STRING>): roles granted to the useris_admin (BOOLEAN): whether the user has the admin role
|
GQLRETURN CURRENT_USER
Access individual fields:
GQLRETURN CURRENT_USER.username, CURRENT_USER.is_admin
Use in a query to filter or record the acting user:
GQLMATCH (n:Post) WHERE n.author = CURRENT_USER.username RETURN n
GQLINSERT (:AuditLog {action: "delete", user: CURRENT_USER.username, at: CURRENT_TIMESTAMP})
Returns the name of the graph the query is running against. Returns NULL when no graph is selected for the session.
| Syntax | CURRENT_GRAPH |
| Return Type | STRING or NULL |
GQLRETURN CURRENT_GRAPH
These values are evaluated once per query and are equivalent to the zero-argument forms of the corresponding datetime functions.
Returns the current local date. Equivalent to date().
| Syntax | CURRENT_DATE |
| Return Type | DATE |
GQLRETURN CURRENT_DATE, date()
Returns the current time with timezone. Equivalent to zoned_time().
| Syntax | CURRENT_TIME |
| Return Type | ZONED TIME |
GQLRETURN CURRENT_TIME, zoned_time()
Returns the current datetime with timezone. Equivalent to zoned_datetime() and now().
| Syntax | CURRENT_TIMESTAMP |
| Return Type | ZONED DATETIME |
GQLRETURN CURRENT_TIMESTAMP, zoned_datetime(), now()
Returns the current time without timezone. Equivalent to local_time().
| Syntax | LOCAL_TIME |
| Return Type | LOCAL TIME |
GQLRETURN LOCAL_TIME, local_time()
Returns the current datetime without timezone. Equivalent to local_datetime().
| Syntax | LOCAL_TIMESTAMP |
| Return Type | LOCAL DATETIME |
GQLRETURN LOCAL_TIMESTAMP, local_datetime()