• Start

Functions

/

Database functions

Overview

Built-in SurrealQL database functions and constants, along with JavaScript and SurrealML functions.

Database functions are SurrealQL’s built-in, namespaced helpers (string::split(), math::mean(), time::now(), and so on). They run inside the database engine, are documented module-by-module in this section, and are the usual choice for everyday querying and data shaping.

SurrealQL also supports other kinds of callable logic:

For the full module list, short examples per module, and calling conventions (classic :: paths, method chaining, and v3 underscore paths), open the database functions catalogue.

Several modules expose constants: fixed values referenced like math::pi or time::minimum (without parentheses) alongside callable functions on the same pages:

  • Math constants — numeric values such as math::e, math::pi, τ, infinities, and common fractions.

  • Time constantstime::epoch, time::minimum, and time::maximum.

  • Duration constantsduration::max as the greatest representable duration.

You can also write your own functions in Rust that can be compiled to WASM modules, linked to and called from the database. For more on how extensions are built and run, see this page.

Was this page helpful?