Skip to content

Commit 6ed762a

Browse files
authored
Merge branch 'docs' into check-links
2 parents 62c2940 + 1c9df8e commit 6ed762a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

usage/sync-rules/operators-and-functions.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Operators and Functions"
33
description: "Operators and functions can be used to transform columns/fields before being synced to a client."
44
---
55

6-
When filtering on parameters (token or [client parameters](/usage/sync-rules/advanced-topics/client-parameters) in the case of [parameter queries](/usage/sync-rules/parameter-queries), and bucket parameters in the case of [data queries](/usage/sync-rules/data-queries)), operators can only be used in a limited way. Typically only `=` , `IN` and `IS NULL` are allowed on the parameters, and special limits apply when combining clauses with `AND`, `OR` or `NOT`. The exact rules are still being refined — make sure to validate and test the Sync Rules.
6+
When filtering on parameters (token or [client parameters](/usage/sync-rules/advanced-topics/client-parameters) in the case of [parameter queries](/usage/sync-rules/parameter-queries), and bucket parameters in the case of [data queries](/usage/sync-rules/data-queries)), operators can only be used in a limited way. Typically only `=` , `IN` and `IS NULL` are allowed on the parameters, and special limits apply when combining clauses with `AND`, `OR` or `NOT`.
77

88
When transforming output columns/fields, or filtering on row/document values, those restrictions do not apply.
99

@@ -17,32 +17,32 @@ Some fundamental restrictions on these operators and functions are:
1717

1818
### Operators
1919

20-
| Category | Operators | Notes |
20+
| Category | Operators | Notes |
2121
| ------------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
22-
| Comparison | \= != < \> \<= \>= | If either parameter is null, this evaluates to null. |
23-
| Null | IS NULL, IS NOT NULL | |
24-
| Mathematical | + \- \* / | |
25-
| Logical | AND, OR, NOT | |
26-
| Cast | CAST(x AS type)<br/>x :: type | Cast to text, numeric, integer, real or blob |
27-
| JSON | json `->` 'path'<br/> json `->>` 'path' | `->` Returns the value as a JSON string<br/> `->>` Returns the extracted value. |
28-
| Text concatenation | | Joins two text values together. |
29-
| Arrays | \<left> IN \<right> | Returns true if the left value is present in the right JSON array. In data queries, only the left value |
22+
| Comparison | `= != < > <= >=` | If either parameter is null, this evaluates to null. |
23+
| Null | `IS NULL`, `IS NOT NULL` | |
24+
| Mathematical | `+ - * /` | |
25+
| Logical | `AND`, `OR`, `NOT` | |
26+
| Cast | `CAST(x AS type)`<br/>`x :: type` | Cast to text, numeric, integer, real or blob. |
27+
| JSON | `json -> 'path'`<br/> `json ->> 'path'` | `->` Returns the value as a JSON string.<br/> `->>` Returns the extracted value. |
28+
| Text concatenation | `\|\|` | Joins two text values together. |
29+
| Arrays | `<left> IN <right>` | Returns true if the `left` value is present in the `right` JSON array. In data queries, only the `left` value may be a bucket parameter. In parameter queries, the `left` or `right` value may be a bucket parameter. Differs from the SQLite operator in that it can be used directly on a JSON array. |
3030

3131
### Functions
3232

3333
| Function | Description |
3434
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
3535
| [upper(text)](https://www.sqlite.org/lang_corefunc.html#upper) | Convert text to upper case. |
3636
| [lower(text)](https://www.sqlite.org/lang_corefunc.html#lower) | Convert text to lower case. |
37-
| [substring(text, start, end)](https://sqlite.org/lang_corefunc.html#substr) | Extracts a portion of a string based on specified starting and ending indexes. |
37+
| [substring(text, start, length)](https://sqlite.org/lang_corefunc.html#substr) | Extracts a portion of a string based on specified start index and length. Start index is 1-based. |
3838
| [hex(data)](https://www.sqlite.org/lang_corefunc.html#hex) | Convert blob or text data to hexadecimal text. |
3939
| base64(data) | Convert blob or text data to base64 text. |
4040
| [length(data)](https://www.sqlite.org/lang_corefunc.html#length) | For text, return the number of characters. For blob, return the number of bytes. For null, return null. For integer and real, convert to text and return the number of characters. |
4141
| [typeof(data)](https://www.sqlite.org/lang_corefunc.html#typeof) | text, integer, real, blob or null |
42-
| [json\_extract(data, path)](https://www.sqlite.org/json1.html#jex) | Same as `->>` operator, but the path must start with $. |
42+
| [json\_extract(data, path)](https://www.sqlite.org/json1.html#jex) | Same as `->>` operator, but the path must start with `$.` |
4343
| [json\_array\_length(data)](https://www.sqlite.org/json1.html#jarraylen) | Given a JSON array (as text), returns the length of the array. If data is null, returns null. If the value is not a JSON array, returns 0. |
4444
| [json\_valid(data)](https://www.sqlite.org/json1.html#jvalid) | Returns 1 if the data can be parsed as JSON, 0 otherwise. |
45-
| json\_keys(data) | Returns the set of keys as a JSON array. |
45+
| json\_keys(data) | Returns the set of keys of a JSON object as a JSON array. |
4646
| [ifnull(x,y)](https://www.sqlite.org/lang_corefunc.html#ifnull) | Returns x if non-null, otherwise returns y. |
4747
| [unixepoch(datetime, \[modifier\])](https://www.sqlite.org/lang_datefunc.html) | Returns a datetime as Unix timestamp. If modifier is "subsec", the result is a floating point number, with milliseconds including in the fraction. The datetime argument is required - this function cannot be used to get the current time. |
4848
| [datetime(datetime, \[modifier\])](https://www.sqlite.org/lang_datefunc.html) | Returns a datetime as a datetime string, in the format YYYY-MM-DD HH:MM:SS. If the specifier is "subsec", milliseconds are also included. If the modifier is "unixepoch", the argument is interpreted as a unix timestamp. Both modifiers can be included: datetime(timestamp, 'unixepoch', 'subsec'). The datetime argument is required - this function cannot be used to get the current time. |

0 commit comments

Comments
 (0)