| ... | @@ -81,12 +81,20 @@ It supports joining, sorting, filtering and returns a nested structure as a resu |
... | @@ -81,12 +81,20 @@ It supports joining, sorting, filtering and returns a nested structure as a resu |
|
|
## Conds
|
|
## Conds
|
|
|
|
|
|
|
|
The **conds** parameter defines the search conditions, which would generally be the "where" in an sql statement.
|
|
The **conds** parameter defines the search conditions, which would generally be the "where" in an sql statement.
|
|
|
|
The main logic is that the search parameters are presented in a data structure and things in arrays are OR'ed, and things in hashes are AND'ed.
|
|
|
|
|
|
|
|
RESTRICTIONS: keys may not contain spaces.
|
|
<https://metacpan.org/pod/release/ILMARI/SQL-Abstract-1.84/lib/SQL/Abstract.pm#WHERE-CLAUSES>
|
|
|
|
|
|
|
|
Examples:
|
|
### Restrictions
|
|
|
|
|
|
|
|
```JSON
|
|
Keys are restricted, as they are not bound, as values are.
|
|
|
|
|
|
|
|
The must either be a reference to a [column](/API/Queries/Attributes#permitted-column-names) or a call
|
|
|
|
to on of the [permitted functions](/API/Queries/Attributes#permitted-functions).
|
|
|
|
|
|
|
|
### Examples:
|
|
|
|
|
|
|
|
```json
|
|
|
{
|
|
{
|
|
|
"conds" : {
|
|
"conds" : {
|
|
|
"me.id" : 1,
|
|
"me.id" : 1,
|
| ... | @@ -94,10 +102,10 @@ Examples: |
... | @@ -94,10 +102,10 @@ Examples: |
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
```SQL
|
|
```sql
|
|
|
WHERE ( ( me.id = ? AND me.name = ? ) )
|
|
WHERE ( ( me.id = ? AND me.name = ? ) )
|
|
|
```
|
|
```
|
|
|
```JSON
|
|
```json
|
|
|
{
|
|
{
|
|
|
"conds" : {
|
|
"conds" : {
|
|
|
"me.id" : {"<" : 5},
|
|
"me.id" : {"<" : 5},
|
| ... | @@ -105,10 +113,10 @@ WHERE ( ( me.id = ? AND me.name = ? ) ) |
... | @@ -105,10 +113,10 @@ WHERE ( ( me.id = ? AND me.name = ? ) ) |
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
```SQL
|
|
```sql
|
|
|
WHERE ( ( me.id < ? AND me.name = ? ) )
|
|
WHERE ( ( me.id < ? AND me.name = ? ) )
|
|
|
```
|
|
```
|
|
|
```JSON
|
|
```json
|
|
|
{
|
|
{
|
|
|
"conds" : {
|
|
"conds" : {
|
|
|
"-or" : [
|
|
"-or" : [
|
| ... | @@ -118,17 +126,14 @@ WHERE ( ( me.id < ? AND me.name = ? ) ) |
... | @@ -118,17 +126,14 @@ WHERE ( ( me.id < ? AND me.name = ? ) ) |
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
```
|
|
```
|
|
|
```SQL
|
|
```sql
|
|
|
WHERE ( me.id < ? OR me.name = ? ) )
|
|
WHERE ( me.id < ? OR me.name = ? ) )
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
For more examples of search options see [Query-Search-Options](/API/Queries/Query-Search-Options) and [Query-Examples](/API/Queries/Query-Examples).
|
|
For more examples of search options see [Query-Search-Options](/API/Queries/Query-Search-Options) and [Query-Examples](/API/Queries/Query-Examples).
|
|
|
|
|
|
|
|
<https://metacpan.org/pod/release/ILMARI/SQL-Abstract-1.84/lib/SQL/Abstract.pm#WHERE-CLAUSES>
|
|
|
|
|
|
|
|
|
|
## [Attributes](/API/Queries/Attributes)
|
|
## [Attributes](/API/Queries/Attributes)
|
|
|
|
|
|
|
|
|
|
|
|
|
# Query Count `/data/$model/$entity/query/count`
|
|
# Query Count `/data/$model/$entity/query/count`
|
|
|
|
|
|
|
|
This endpoint takes the same parameter as a query but will return only the "meta" part of the query reply:
|
|
This endpoint takes the same parameter as a query but will return only the "meta" part of the query reply:
|
| ... | | ... | |