0.2.0 • Published 8 years ago

objection-find-query v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

objection-find-query

Build Status

Construct complex api query on the frontend, for endpoints implementing objection-find.

Usage:

/*
  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 ofq = require('objection-find-query');
const formattedParams = ofq.format(params);

Installation

npm install objection-find-query