Field expression functions
Text functions
| Function | Signature | Description | Example |
|---|---|---|---|
trim |
|
The function removes the leading and trailing whitespaces, see strings.TrimSpace |
|
trimLeft |
|
The function removes the leading occurence of characters |
|
trimRight |
|
The function removes the trailing occurence of characters |
|
length |
|
The function returns the length of the string |
|
toLower |
|
The function converts all characters to lowercase. |
|
toUpper |
|
The function converts all characters to uppercase. |
|
shortest |
|
The function returns the shortest string. |
|
longest |
|
The function returns the longest string. |
|
format |
|
Returns the formatted string., see String formatting for available formatting options. |
|
title |
|
The function returns the first character uppercased in line of strings. |
|
untitle |
|
The function returns the first character lowercased in line of strings. |
|
repeat |
|
The function repeats string n times, see strings.Repeat |
|
replace |
|
The function returns a copy of the string s with the first n non-overlapping instances of old replaced by new, see strings.Replace |
|
split |
|
The function slices s into all substrings separated by sep and returns a slice of the substrings between those separators, see strings.Split |
|
join |
|
The function concatenates the elements of its first argument to create a single string, see strings.Join |
|
substring |
|
The function extracts a substring from original string specifying end value will not match till end of string |
|
shorten |
|
The function shortens by type (char / word) to {count} occurences followed by ellipsis |
|
camelize |
|
The function camelizes string |
|
snakify |
|
The function snakifies string |
|
isUrl |
|
The function returns true if url is valid |
|
isEmail |
|
The function returns true if an email is valid |
|
hasSubstring |
`hasSubstring(string, substring, case) |
The function checks if a substring exists in original string use watchCase if need case sensitivity |
|
hasPrefix |
|
The function tests whether the string s begins with prefix, see strings.HasPrefix |
|
hasSuffix |
|
The function tests whether the string s ends with suffix, see strings.hasSuffix |
|
Numeric functions
| Function | Signature | Description | Example |
|---|---|---|---|
min |
|
The function returns item with the lowest value. |
|
max |
|
The function returns item with the highest value. |
|
round |
|
The function rounds a floating point number to the specified number of digits. |
|
floor |
|
The function rounds number down to the nearest integer. |
|
ceil |
|
The function rounds number up to the nearest integer. |
|
abs |
|
The function returns the absolute value of x, see math.Abs |
|
log |
|
The function returns the decimal logarithm of x, see math.Log10 |
|
pow |
|
The function returns x**y, the base-x exponential of y, see math.Pow |
|
sqrt |
|
The function returns correctly rounded sqrt, see math.Sqrt |
|
sum |
|
The function returns the sum of all arguments |
|
average |
|
The function returns the average of all arguments |
|
List functions
| Function | Signature | Description | Example |
|---|---|---|---|
push |
|
The function adds an element to the end of list and returns the list. |
|
pop |
|
The function returns the last element off the list. |
|
shift |
|
The function returns the first element of the list. |
|
count |
|
The function returns the number of items when provided as an argument, or the entire length of the array when no argument is provided. |
|
has |
|
The function returns true if any of the values exist in first element |
|
hasAll |
|
The function returns true if all of the values exist in first element |
|
KV functions
|
The resulting type of the KV function is based on the first argument. You may not provide multiple different KV types (KV, KVV, Vars) into the same function. To examplify; |
| Function | Signature | Description | Example |
|---|---|---|---|
set |
|
The function assigns a value to the given KV type. |
|
merge |
|
The function combines all of the given KV types into a single KV type. |
|
filter |
|
The function returns a KV type with only the specified key-value pairs. |
|
omit |
|
The function returns a KV type without the specified key-value pairs. |
|
General functions
| Function | Signature | Description | Example |
|---|---|---|---|
coalesce |
|
The function returns the first non |
|
isEmpty |
|
The function returns true if the value is empty |
|
isNil |
|
The function returns true if the value is Nil |
|
Date Time functions
| Function | Signature | Description | Example |
|---|---|---|---|
earliest |
|
The function returns earliest DateTime. |
|
latest |
|
The function returns latest DateTime. |
|
parseISOTime |
|
The function returns parsed ISO DateTime. |
|
modTime |
|
The function returns the modified time part of the DateTime. |
|
modDate |
|
The function returns modified day part of the DateTime. |
|
modWeek |
|
The function returns modified week part of the DateTime. |
|
modMonth |
|
The function returns modified month part of the DateTime. |
|
modYear |
|
The function returns modified year part of the DateTime. |
|
parseDuration |
|
The function returns parsed duration. |
|
strftime |
|
The function returns DateTime string for the specified date and format, see Date and time formatting for available formatting options. |
|
now |
|
The function returns current DateTime string. |
|
isLeapYear |
|
The function returns true if the specified year is leap year. |
|
isWeekDay |
|
The function returns true if the specified day is week day. |
|
String formatting
%t
- Description
-
Returns the boolean value as true/false.
- Example
-
format("%t", true)results in "true"
%b
- Description
-
Returns the number in base 2 (in the binary format).
- Example
-
format("%b", 10)results in "1010"
%O
- Description
-
Returns the number in base 8 with 0o prefix.
- Example
-
format("%O", 10)results in "0o12"
%x
- Description
-
Returns the number in base 16; lower-case a-f.
- Example
-
format("%x", 10)results in "a"
%X
- Description
-
Returns the number in base 16; upper-case A-F.
- Example
-
format("%X", 10)results in "A"
%b
- Description
-
Returns the floating point number in scientific notation with binary exponent.
- Example
-
format("%b", 10.11)results in "5691424029089464p-49"
%e
- Description
-
Returns the floating point number in scientific notation; lower-case e.
- Example
-
format("%e", 10.11)results in "1.011000e+01"
Date and time formatting
%Y
- Description
-
Returns the year with century as a decimal number.
- example
-
strftime(dateField, "%Y")results in "1993"
%y
- Description
-
Returns the year without century as a decimal number (00-99).
- example
-
strftime(dateField, "%y")results in "93"
%C
- Description
-
Returns year / 100 as a decimal number; single digits are preceded by a zero.
- example
-
strftime(dateField, "%C")results in "19"
%m
- Description
-
Returns the month as a decimal number (01-12).
- example
-
strftime(dateField, "%m")results in "02"
%B
- Description
-
Returns the full national month name.
- example
-
strftime(dateField, "%B")results in "February"
%b
- Description
-
Returns the abbreviated national month name.
- example
-
strftime(dateField, "%b")results in "Feb"
%U
- Description
-
Returns the week number of the year (Sunday as the first day of the week) as a decimal number (00-53).
- example
-
strftime(dateField, "%U")results in "05"
%V
- Description
-
Returns the week number of the year (Monday as the first day of the week) as a decimal number (01-53).
- example
-
strftime(dateField, "%V")results in "05"
%W
- Description
-
Returns the week number of the year (Monday as the first day of the week) as a decimal number (00-53).
- example
-
strftime(dateField, "%W")results in "05"
%A
- Description
-
Returns the full national weekday name.
- example
-
strftime(dateField, "%A")results in "Tuesday"
%a
- Description
-
Returns the abbreviated national weekday name.
- example
-
strftime(dateField, "%a")results in "Tue"
%d
- Description
-
Returns the day of the month as a decimal number (01-31).
- example
-
strftime(dateField, "%d")results in "02"
%e
- Description
-
Returns the day of the month as a decimal number (1-31).
- example
-
strftime(dateField, "%e")results in " 2"
%j
- Description
-
Returns the day of the year as a decimal number (001-366).
- example
-
strftime(dateField, "%j")results in "033"
%u
- Description
-
Returns the weekday (Monday as the first day of the week) as a decimal number (1-7).
- example
-
strftime(dateField, "%u")results in "5"
%w
- Description
-
Returns the weekday (Sunday as the first day of the week) as a decimal number (0-6).
- example
-
strftime(dateField, "%w")results in "2"
%H
- Description
-
Returns the hour (24-hour clock) as a decimal number (00-23).
- example
-
strftime(dateField, "%H")results in "06"
%k
- Description
-
Returns the hour (24-hour clock) as a decimal number (0-23).
- example
-
strftime(dateField, "%k")results in " 6"
%I
- Description
-
Returns the hour (12-hour clock) as a decimal number (01-12).
- example
-
strftime(dateField, "%I")results in "06"
%l
- Description
-
Returns the hour (12-hour clock) as a decimal number (1-12).
- example
-
strftime(dateField, "%l")results in " 6"
%M
- Description
-
Returns the minute as a decimal number (00-59).
- example
-
strftime(dateField, "%M")results in "00"
%S
- Description
-
Returns the second as a decimal number (00-60).
- example
-
strftime(dateField, "%S")results in "00"
%S
- Description
-
Returns the millisecond as a decimal number (000-999).
- example
-
strftime(dateField, "%S")results in "000"
%p
- Description
-
Returns the national representation of either "ante meridiem" (a.m.) or "post meridiem" (p.m.).
- example
-
strftime(dateField, "%p")results in "AM"
%c
- Description
-
Returns the national representation of time and date.
- example
-
strftime(dateField, "%c")results in "Tue Feb 2 06:00:00 1993"
%X
- Description
-
Returns the national representation of the time.
- example
-
strftime(dateField, "%X")results in "06:00:00"
%x
- Description
-
Returns the national representation of the date.
- example
-
strftime(dateField, "%x")results in "02/02/93"
%z
- Description
-
Returns the time zone offset from UTC.
- example
-
strftime(dateField, "%z")results in "-0500"