# objection-find-query-builder

> query paramter constructor for objection-find

Latest version **1.9.0** (published 2018-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install objection-find-query-builder
pnpm add objection-find-query-builder
yarn add objection-find-query-builder
bun add objection-find-query-builder
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.0 |
| Published | 2018-03-26 |
| First published | 2018-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Unpacked size | 29.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | AFM Sayem |
| Maintainers | igor-savin-ht, kibertoad, nikita-gedgaudas-ht |
| Keywords | objection, objection.js, objection-find |

## Links

- npm: https://www.npmjs.com/package/objection-find-query-builder
- Repository: https://github.com/kibertoad/objection-find-query
- Homepage: https://github.com/kibertoad/objection-find-query#readme
- Issues: https://github.com/kibertoad/objection-find-query/issues
- npm.io page: https://npm.io/package/objection-find-query-builder

## Recent versions

- 1.9.0 (latest) — 2018-03-26
- 1.8.0 — 2018-03-13
- 1.7.1 — 2018-03-09
- 1.7.0 — 2018-03-09
- 1.6.0 — 2018-01-30
- 1.5.0 — 2018-01-25
- 1.4.1 — 2018-01-25
- 1.4.0 — 2018-01-25
- 1.3.0 — 2018-01-17
- 1.2.2 — 2018-01-12
- 1.2.0 — 2018-01-11
- 1.1.0 — 2018-01-11
- 1.0.1 — 2018-01-09
- 1.0.0 — 2018-01-09

## README

## objection-find-query

Based on original work by AFM Sayem - https://github.com/afm-sayem/objection-find-query

Construct complex api query on the frontend, for endpoints implementing [objection-find](https://github.com/Vincit/objection-find).


Usage:

## Builder

```

const queryBuilder = require('objection-find-query-builder');

const builder = queryBuilder.builder();
const formattedParams = builder.greaterThan('field', 1).lessThan('field', 3).build();

```


## Eager param mutation

```

const eagerUtils = require('objection-find-query-builder').eagerUtils;

const modifiedParamsRemoved = eagerUtils.removeFromEagerParam('[param1,param2,param3]', 'param2');
const modifiedParamsAppended = eagerUtils.appendToEagerParam('[param1]', 'param2');

```

## Manual formatting

```javascript

/*
  expected format:
  {
    op: {
      column: value
    }
  }

  sample input:
  {
    gt: {
      released: 1953,
      gross_income: 200000,
      actors: {
        age: 23
      }
    },
    lt: {
      released: 1984
    },
    in: {
      ratings: [3, 4]
    }
  }

  output:
  {
    'released:gt': 1953,
    'gross_income:gt': 200000,
    'actors.age:gt': 23,
    'released:lt': 1984,
    'ratings:in': 3,4
  }
*/

const queryBuilder = require('objection-find-query-builder');
const formattedParams = queryBuilder.format(params);

```

Supported operations:

* greaterThan
* lessThan
* greaterThanOrEqual
* lessThanOrEqual
* equal
* inSet (value equals to any value in a given array)
* anyLike (value of any specified fields matches given string with optional wildcards)
* anyLikeLower (value of any specified fields matches given string with optional wildcards - case insensitive)
* eager (retrieve entities from specified relationship eagerly)
* orderByAsc
* orderByDesc
* groupBy
* count
* rangeStart
* rangeEnd

## Installation

`npm install objection-find-query-builder`

---
_Source: https://npm.io/package/objection-find-query-builder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
