You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -33,21 +33,21 @@ For the next few sections, assume the `query` variable has been defined as:
33
33
34
34
```ts
35
35
const query:RuleGroupType= {
36
-
id: "root",
37
-
combinator: "and",
36
+
id: 'root',
37
+
combinator: 'and',
38
38
not: false,
39
39
rules: [
40
40
{
41
-
id: "rule1",
42
-
field: "firstName",
43
-
value: "Steve",
44
-
operator: "=",
41
+
id: 'rule1',
42
+
field: 'firstName',
43
+
value: 'Steve',
44
+
operator: '=',
45
45
},
46
46
{
47
-
id: "rule2",
48
-
field: "lastName",
49
-
value: "Vai",
50
-
operator: "=",
47
+
id: 'rule2',
48
+
field: 'lastName',
49
+
value: 'Vai',
50
+
operator: '=',
51
51
},
52
52
],
53
53
};
@@ -62,7 +62,7 @@ To export the internal query representation like what `react-querybuilder` passe
62
62
```ts
63
63
formatQuery(query);
64
64
// or
65
-
formatQuery(query, "json");
65
+
formatQuery(query, 'json');
66
66
```
67
67
68
68
The output will be a multi-line string representation of the query using 2 spaces for indentation.
@@ -94,7 +94,7 @@ The output will be a multi-line string representation of the query using 2 space
94
94
To export the internal query representation without formatting (single-line, no indentation) and without the `id` attribute on each object, use the "json_without_ids" format. This is useful if you need to serialize the query for storage.
95
95
96
96
```ts
97
-
formatQuery(query, "json_without_ids");
97
+
formatQuery(query, 'json_without_ids');
98
98
```
99
99
100
100
Output:
@@ -108,7 +108,7 @@ Output:
108
108
`formatQuery` can export SQL compatible with most RDBMS engines. To export a SQL `WHERE` clause, use the "sql" format.
109
109
110
110
```ts
111
-
formatQuery(query, "sql");
111
+
formatQuery(query, 'sql');
112
112
```
113
113
114
114
Output:
@@ -122,7 +122,7 @@ Output:
122
122
To export a SQL `WHERE` clause with bind variables instead of explicit values, use the "parameterized" format. The output is an object with `sql` and `params` attributes.
123
123
124
124
```ts
125
-
formatQuery(query, "parameterized");
125
+
formatQuery(query, 'parameterized');
126
126
```
127
127
128
128
Output:
@@ -139,7 +139,7 @@ Output:
139
139
If anonymous parameters (aka bind variables) are not acceptable, `formatQuery` can output named parameters based on the field names. Use the "parameterized_named" format. The output object is similar to the "parameterized" format, but the `params` attribute is an object instead of an array.
140
140
141
141
```ts
142
-
formatQuery(query, "parameterized_named");
142
+
formatQuery(query, 'parameterized_named');
143
143
```
144
144
145
145
Output:
@@ -159,7 +159,7 @@ Output:
159
159
For MongoDB-compatible output, use the "mongodb" format.
160
160
161
161
```ts
162
-
formatQuery(query, "mongodb");
162
+
formatQuery(query, 'mongodb');
163
163
```
164
164
165
165
Output:
@@ -178,31 +178,31 @@ If you need to control the way the value portion of the output is processed, you
@@ -25,10 +25,7 @@ You can see an example of the default validator in action in the [demo](https://
25
25
### `findPath`
26
26
27
27
```ts
28
-
function findPath(
29
-
path:number[],
30
-
query:RuleGroupType
31
-
):RuleType|RuleGroupType;
28
+
function findPath(path:number[], query:RuleGroupType):RuleType|RuleGroupType;
32
29
```
33
30
34
31
`findPath` is a utility function for finding the rule or group within the query hierarchy that has a given `path`. Useful in custom [`onAddRule`](./querybuilder#onaddrule) and [`onAddGroup`](./querybuilder#onaddgroup) functions.
0 commit comments