ransack.function module
function.py - Defines built-in functions usable in query expressions.
This module provides a set of predefined utility functions that can be invoked from within query expressions. These functions enable common operations such as determining the length of a value or obtaining the current time.
- Functions:
length(x): Returns the length of a string, list, or IP range/network.
now(): Returns the current UTC datetime.
These functions are registered in the predefined_functions dictionary and are automatically available during query evaluation.
- Example usage in query:
length(some_field) > 3 or now() > 2024-01-01T00:00:00Z