Skip to main content

Global functions

Rell provides a collection of built-in global functions for common tasks. For complete API documentation, see the Standard Library reference.

Overview​

Global functions are available without any namespace prefix and cover:

  • Math operations – abs, min, max for integer, big_integer, and decimal types
  • Collection checks – empty and exists for nullable values, lists, sets, and maps
  • Output – print and log for debugging
  • Cryptographic hashes – sha256, keccak256
  • Signature verification – verify_signature
  • Ethereum operations – eth_ecrecover for public key recovery
  • Error handling – require, rell.error, try_call, and try_call_catch, documented under require and error handling

Key functions​

Using empty and exists in at-expressions​

Both empty() and exists() support nested at-expressions, enabling efficient SQL queries:

// Find users with no company in their city
user @* {
empty(company @* { .city == user.city })
}

// Find users with at least one company in their city
user @* {
exists(company @* { .city == user.city })
}

Use @* in nested at-expressions to execute as a single SQL query. Other cardinality operators (@+, @?, @) result in separate queries.