# ex-objection-query-builder

> An extended query builder for Objection.js

Latest version **1.1.3** (published 2020-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install ex-objection-query-builder
pnpm add ex-objection-query-builder
yarn add ex-objection-query-builder
bun add ex-objection-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.1.3 |
| Published | 2020-03-03 |
| First published | 2020-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Diego Barros |
| Maintainers | diegobarros0701 |
| Keywords | objection, js, query, builder, extended |

## Links

- npm: https://www.npmjs.com/package/ex-objection-query-builder
- Repository: https://github.com/diegobarros0701/ex-objection-query-builder
- npm.io page: https://npm.io/package/ex-objection-query-builder

## Dependencies (1)

- [objection](https://npm.io/package/objection.md) ^2.1.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.3 (latest) — 2020-03-03
- 1.1.2 — 2020-02-05
- 1.1.1 — 2020-02-05
- 1.1.0 — 2020-02-05
- 1.0.1 — 2020-02-05
- 1.0.0 — 2020-02-05

## README

# Extended Objection Query Builder

An extended query builder for Objection.js.  
This package adds extra methods to the Objection.js query builder.

## Installation

```
npm install ex-objection-query-builder
```
or
```
yarn add ex-objection-query-builder
```

## How to use

Just require the package in your model and then override the `QueryBuilder` method.  
Example:

```javascript
const { Model } = require('objection');
const { ExObjectionQueryBuilder } = require('ex-objection-query-builder');

class User extends Model {
  static get QueryBuilder() {
    return ExObjectionQueryBuilder;
  }
}
```

## Methods

All the available methods are listed below

### # whereLike(columns = [], value, options = {})

Search for results that **contains** the specified value at the specifieds columns.  

| Parameter | Type | Default | Description |
| -- | -- | -- | -- |
| `columns` | `string[]` | `[]` | An array containing the columns to filter  |
| `value` | `string` | `undefined` | The value to filter |
| `options` | `object` | `{}` | A set of configurations for the filter (see [options object](#options-object)) |

#### # options object

| Property | Type | Default | Description |
| -- | -- | -- | -- |
| `ignoreAccent` | `boolean` | `true` | Ignore words accents |
| `ignoreCase` | `boolean` | `true` | Ignore words case |
| `ignoreMask` | `boolean` | `true` | Remove any mask (`-.,()/\[]`) of the informed value |


**Important:**  

The `ignoreAccent` is working only with postgres because of the use of `unaccent`function.  
To use it you need to activate this function. For that just ran the following:

```
CREATE EXTENSION unaccent;
```  
  
The `ignoreCase` also works only with postgres because of the operator `ILIKE`

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