1.1.3 • Published 4 years ago

ex-objection-query-builder v1.1.3

Weekly downloads
12
License
MIT
Repository
github
Last release
4 years ago

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:

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.

ParameterTypeDefaultDescription
columnsstring[][]An array containing the columns to filter
valuestringundefinedThe value to filter
optionsobject{}A set of configurations for the filter (see options object)

# options object

PropertyTypeDefaultDescription
ignoreAccentbooleantrueIgnore words accents
ignoreCasebooleantrueIgnore words case
ignoreMaskbooleantrueRemove any mask (-.,()/\[]) of the informed value

Important:

The ignoreAccent is working only with postgres because of the use of unaccentfunction.
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

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago