Expression functions
The functions an expression can call, by name (split(t, " "), not t.split(" ") — EXPR-10). Operators and the rest of the expression language are in the SPEC.
Passwords
hashPassword(password)
bcrypt hash of a password, for storing. Never store the password itself.
Specified by: AUTH-3
verifyPassword(password, hashed)
True when password matches a hash made by hashPassword.
Specified by: AUTH-3
Dates
now()
Current local datetime.
dateAdd(unit, amount, start= None)
Add an interval to a datetime (defaults to now).
dateFormat(value, fmt= '%Y-%m-%d %H:%M:%S')
Format a datetime (or ISO string) with a strftime pattern.
dateDiff(unit, start, end)
Whole units between two datetimes.
Strings
upper(v)
The text in upper case.
lower(v)
The text in lower case.
trim(v)
The text without the spaces around it.
replace(v, old, new)
The text with every old replaced by new.
split(v, sep= ',')
The text split by sep into a list (EXPR-9, EXPR-10).
Specified by: EXPR-9 · EXPR-10
contains(v, needle)
True when the text contains needle.
slugify(v)
'Olá, Mundo!' -> 'ola-mundo': for URLs made from a title (EXPR-9).
Specified by: EXPR-9
urlencode(v)
EXPR-12: a value made safe to put in a URL — q:redirect url="/?q={urlencode(q)}".
Specified by: EXPR-12
Collections
get(container, key, default= None)
EXPR-16: an optional key or index — default when it is not there.
Specified by: EXPR-16
len(v)
The number of items (or characters); 0 for a value without a length.
Specified by: SET-5
first(v)
The first item, or null for an empty list.
last(v)
The last item, or null for an empty list.
join(v, sep= ', ')
The items as text, joined by sep.
sort(v, reverse= False)
The items sorted (descending with reverse=true).
Numbers
round(v, digits= 0)
Rounded to digits places, half away from zero: round(2.5) is 3 (EXPR-9).
ceil(v)
The smallest whole number not below the value (EXPR-9).
Specified by: EXPR-9
floor(v)
The largest whole number not above the value (EXPR-9).
Specified by: EXPR-9
abs(x)
The absolute value.
min(a, b, …) / min(list)
The smallest of the values.
max(a, b, …) / max(list)
The largest of the values.
int(x)
The value as a whole number (text or a number; a fraction is cut).
float(x)
The value as a number with decimals.
str(x)
The value as text.
Chance (expr-15)
random(low= None, high= None)
random() is a number in [0, 1); random(a, b) an integer from a to b.
Specified by: EXPR-15
chance(p)
True with probability p (0 to 1).
Specified by: EXPR-15
pick(items)
One element of a list, at random.
Specified by: EXPR-15