0.0.4 • Published 8 months ago

@comodinx/query-parser v0.0.4

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
8 months ago

Query parser

@comodinx/query-parser is a module for parser query parameters on ORM object (sequelize).

Index

Download & Install

NPM

$ npm install @comodinx/query-parser

Source code

$ git clone https://gitlab.com/comodinx/query-parser.git
$ cd query-parser
$ npm install

How is it used?

This section was designed to facilitate the interpretation of query parameters.

What parameters are accepted?

Pagination

NameTypeDefault ValueDescription
pagenumber1Indicates which page of the list should be returned.
pageSizenumbernullIndicates the number of records per page.

Sorting

NameTypeDefault ValueDescription
orderstringnullSorting to apply in the search results.
Example,
createdAt-DESC

Grouping

NameTypeDefault ValueDescription
groupstringnullGrouping to apply in the search results.
Example,
platform

Filtering

NameTypeDefault ValueDescription
filtersstringnullFilters to apply in the search.
All table fields are applicable for filtering.
Example,
statusId eq 1

💡 For more details on how filters work and their syntax, check this link.

Relationships

NameTypeDefault ValueDescription
includestringnullRelationships to include in the search results.
Example,
status,r-products

Fields

NameTypeDefault ValueDescription
fieldsstring"*"Fields to include in the search results.
Example,
id,statusId

Extras

NameTypeDefault ValueDescription
extrasstringnullAdditional fields to include in the search results.
Example,
category,brand

Tests

For more concrete examples, I INVITE YOU TO CHECK THE TESTS :)

Run unit tests

npm test
0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago