You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# Site-O-Mat Query
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
Setup this registry in your project .npmrc file:
|
|
|
|
|
|
|
|
```
|
|
|
|
@helpers:registry=https://gitea.node001.net/api/packages/HerrHase/npm/
|
|
|
|
```
|
|
|
|
|
|
|
|
Install with npm or yarn
|
|
|
|
|
|
|
|
```
|
|
|
|
npm i --save-dev @helpers/siteomat-query
|
|
|
|
yarn add --dev @helpers/siteomat-query
|
|
|
|
```
|
|
|
|
|
|
|
|
## Filter
|
|
|
|
|
|
|
|
Basic Usage:
|
|
|
|
|
|
|
|
```
|
|
|
|
import { Filter } from '@helpers/siteomat-query'
|
|
|
|
|
|
|
|
const filter = new Filter(options)
|
|
|
|
const isValid = filter.validate(result)
|
|
|
|
```
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
|-------------|-----------|-------------|
|
|
|
|
| _eq | {Mixed} | is equal |
|
|
|
|
| _neq | {Mixed} | is not equal |
|
|
|
|
| _in | {Mixed} | in array |
|
|
|
|
| _lt | {Mixed} | is lesser than |
|
|
|
|
| _lte | {Mixed} | is lesser or equal than |
|
|
|
|
| _gt | {Mixed} | is greater than |
|
|
|
|
| _gte | {Mixed} | is greater or equal than |
|
|
|
|
| _null | {Boolean} | is null |
|
|
|
|
| _nnull | {Boolean} | is not null |
|
|
|
|
|
|
|
|
## Reduce
|
|
|
|
|
|
|
|
Skip or Limit Elements from a an Array.
|
|
|
|
|
|
|
|
Basic Usage:
|
|
|
|
|
|
|
|
```
|
|
|
|
import { reduce } from '@helpers/siteomat-query'
|
|
|
|
results = reduce({
|
|
|
|
limit: 5
|
|
|
|
}, results)
|
|
|
|
```
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
|
|
|
| Name | Type | Description |
|
|
|
|
|-------------|-----------|-------------|
|
|
|
|
| limit | {Number} | limit elements |
|
|
|
|
| offset | {Number} | skip elements |
|
|
|
|
|
|
|
|
## OrderBy
|
|
|
|
|
|
|
|
Basic Usage:
|
|
|
|
|
|
|
|
```
|
|
|
|
import { orderBy } from '@helpers/siteomat-query'
|
|
|
|
results = orderBy([
|
|
|
|
-published_at
|
|
|
|
], results)
|
|
|
|
```
|