General-purpose functions
Overview
Functions are used to build filters for selecting elements from collections via the REST API, and also functional field values that set aggregation parameters.
Function construction
Functions are specified as a JSON list, where the first element is the function name and the following elements are parameter values, which in the general case can also be functions.
["FunctionName"]
["null"]
["FunctionName",Arg]
["toYYYY","2021-12-01T13:08.25.22Z"] ["property","fieldname"]
["FunctionName",Arg1,Arg2]
["+",3,5] ["or","true","false"] ["like","abc","a*c"]
["FunctionName",Arg1,Arg2,...]
["+",3,5,6,8] ["list","a","bb","ccc","ddd"] ["join",", ","first","second","third"] ["like","abc","a*c"]
Building a superposition of functions
A nested function can be specified as any argument. Arbitrary nesting depth is allowed.
["+",["property","x"],["property","y"]]
["toYYYY",["property","datetime"]]
["like","abc","a*c"]
["and",
["or",
["==",["property","name"],"abc"],
["contains",["property","name"],"qwe"],
["in",["property","p"],["list",3,6,9,12]],
["==",["rem",["property","value"],10],0]]
List of supported functions
-
isnull (arg) -
isnotnull (arg) -
not (arg), synonyms:! -
bool (arg) -
integer (arg) -
float (arg) -
string (arg) -
uuid (arg) -
const (arg) -
lower (arg) -
upper (arg) -
year (arg), synonyms:toYYYY,toYear -
quarter (arg) -
month (arg) -
day (arg) -
hour (arg) -
minute (arg) -
second (arg) -
weekday (arg) -
toYYYYMM (arg) -
toYYYYMMDD (arg) -
concat (…), synonyms:. -
join (delimiter, …), synonyms:... The first argument is the delimiter, the rest are values to join, example: '["join",", ","a","b","c"]'. -
list (…), example: '["list","a","b","c"]'. For postgresql converted to('a','b','c'). -
array (…), example: '["list","a","b","c"]'. For postgresql converted toarray['a','b','c']. -
null () -
+ (…), synonyms:add -
- (arg1, arg2), synonyms:sub -
* (arg1, arg2), synonyms:mul -
/ (arg1, arg2), synonyms:div -
// (arg1, arg2), synonyms:ddiv -
% (arg1, arg2), synonyms:rem -
&& (…), synonyms:and, -
|| (…), synonyms:or, -
== (arg1, arg2), synonyms:equal,equals -
!= (arg1, arg2), synonyms:notequal,notequals,<> -
> (arg1, arg2), synonyms:greater, -
>= (arg1, arg2), synonyms:notless,greaterorequal -
< (arg1, arg2), synonyms:less -
⇐ (arg1, arg2), synonyms:notgreater,lessorequal -
in (arg1, arg2), example: '["in",["property","role"],["list","role1","role2"]]' -
inlist (arg1, arg2), example: '["inlist","admin",["property","roles"]]' -
hasAny (arg1, arg2), example: '["hasAny",["property","roles"],["array","role5","role7","role9"]]' -
hasAll (arg1, arg2), example: '["hasAll",["property","roles"],["array","role5","role7"]]' -
contains (arg1, arg2) -
like (arg1, arg2) -
interval_in_minutes (arg1, arg2) -
dateadd (arg1, arg2) -
datediff (arg1, arg2) -
between (arg1, arg2, arg3