Selection query as defined by JSData's Query Syntax.
Properties:
Name | Type | Argument | Description |
---|---|---|---|
limit |
Number |
<optional> |
See query.limit. |
offset |
Number |
<optional> |
See query.offset. |
orderBy |
String | Array.<Array> |
<optional> |
See query.orderBy. |
skip |
Number |
<optional> |
Alias for query.offset. |
sort |
String | Array.<Array> |
<optional> |
Alias for query.orderBy. |
where |
Object |
<optional> |
See query.where. |
Examples
store.findAll('post').then((posts) => {
console.log(posts) // [...]
})
const posts = store.filter('post')
console.log(posts) // [...]
const PAGE_SIZE = 10
let currentPage = 3
// Retrieve a filtered page of blog posts
store.findAll('post', {
where: {
status: {
// WHERE status = 'published'
'==': 'published'
},
author: {
// AND author IN ('bob', 'alice')
'in': ['bob', 'alice'],
// OR author IN ('karen')
'|in': ['karen']
}
},
orderBy: [
// ORDER BY date_published DESC,
['date_published', 'DESC'],
// ORDER BY title ASC
['title', 'ASC']
],
// LIMIT 10
limit: PAGE_SIZE,
// SKIP 20
offset: PAGE_SIZE * (currentPage 1)
}).then((posts) => {
console.log(posts) // [...]
})
Members
-
<static> limit
-
Maximum number of records to retrieve.
Exampleconst PAGE_SIZE = 10 let currentPage = 1 PostService.findAll({ offset: PAGE_SIZE * (currentPage 1) limit: PAGE_SIZE })
-
<static> offset
-
Number of records to skip.
Exampleconst PAGE_SIZE = 10 let currentPage = 1 PostService.findAll({ offset: PAGE_SIZE * (currentPage 1) limit: PAGE_SIZE })
-
<static> orderBy
-
Determines how records should be ordered in the result.
ExampleTODO
-
<static> where
-
Filtering criteria. Records that do not meet this criteria will be exluded from the result.
ExampleTODO