Skip to content

Commit a81c84f

Browse files
committed
Update README
1 parent 81373b2 commit a81c84f

File tree

1 file changed

+71
-5
lines changed

1 file changed

+71
-5
lines changed

README.md

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,86 @@ Complex calculation:
5151

5252
## Available operators
5353

54+
### Type conversion
55+
56+
Operator | Description
57+
--- | ---
58+
`INT(a)` | convert to integer
59+
`FLOAT(a)` | convert to float
60+
`STRING(a)` | convert to string
61+
62+
### Format
63+
64+
Operator | Description
65+
--- | ---
66+
`SLUG(a)` | transform string to slug (e.g. "This is a title" → "this-is-a-title")
67+
`CURRENCY(a)` | format number to currency (e.g. 3000 → "3,000")
68+
69+
### Date
70+
5471
Operator | Description
5572
--- | ---
73+
`DATE_ISO(a)` | transform date or date-like object to ISO string
74+
`DATE_UTC(a)` | transform date or date-like object to UTC string
75+
76+
### Arithmetic
77+
78+
Operator | Description
79+
--- | ---
80+
`ABS(a)` | absolute
81+
`SQRT(a)` | square root
82+
`SUM(a)` | sum an array of numbers
5683
`SUM(a, b)` | a + b
84+
`AVERAGE(a)` | average value of an array of number
5785
`SUBTRACT(a, b)` | a - b
5886
`MULTIPLY(a, b)` | a * b
5987
`DIVIDE(a, b)` | a / b
6088
`REMAINDER(a, b)` | a % b
6189
`ROUND(a, n)` | round number `a` to `n` number of decimals, similar to `toFixed`
90+
`MAX(a, b)` | max value
91+
`MIN(a, b)` | min value
92+
`POWER(a, b)` | a^b
93+
94+
### String
95+
96+
Operator | Description
97+
--- | ---
98+
`STR_LEN(a)` | length of string
99+
`LOWER(a)` | to lower case
100+
`UPPER(a)` | to upper case
101+
`TRIM(a)` | removes whitespace at the beginning and end of string.
62102
`CONCAT(a, b)` | concat 2 strings
63-
`INT(a)` | convert to integer
64-
`FLOAT(a)` | convert to float
65-
`STRING(a)` | convert to string
66-
`SLUG(a)` | transform a string to a slug (e.g. "This is a title" → "this-is-a-title")
67-
`CURRENCY(a)` | format number a to currency (e.g. 3000 → "3,000")
103+
`LEFT(a, b)` | extract `b` characters from the beginning of the string.
104+
`RIGHT(a, b)` | extract `b` characters from the end of the string.
105+
106+
### Boolean
107+
108+
Operator | Description
109+
--- | ---
110+
`NULL(a)` | check is null
111+
`NOT_NULL(a)` | check is not null
112+
`NOT(a)` | logical NOT
113+
`EQUAL(a, b)` | a = b
114+
`NOT_EQUAL(a, b)` | a <> b
115+
`GT(a, b)` | a > b
116+
`GTE(a, b)` | a >= b
117+
`LT(a, b)` | a < b
118+
`LTE(a, b)` | a <= b
119+
`AND(a, b)` | logical AND
120+
`OR(a, b)` | logical OR
121+
122+
### Array
123+
124+
Operator | Description
125+
--- | ---
126+
`ARRAY_LEN(a)` | length of array
127+
128+
### Relational
129+
130+
Operator | Description
131+
--- | ---
132+
`ASUM(a, b)` | Aggregated sum of O2M field. For example: calculate shopping cart total price with `ASUM(products, MULTIPLY(price, quantity))` where `products` is the O2M field in the shopping cart and `price` & `quantity` are 2 fields of `products`.
133+
68134

69135
# Limitation
70136
- Cannot parse literal strings (`{{ 's' }}`).

0 commit comments

Comments
 (0)