ex-objection-query-builder

1.1.3 • Public • Published

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.

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

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 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

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i ex-objection-query-builder

    Weekly Downloads

    4

    Version

    1.1.3

    License

    MIT

    Unpacked Size

    3.8 kB

    Total Files

    6

    Last publish

    Collaborators

    • diegobarros0701