gql-query-generator
This package is a class that allows you to compose a GraphQL
query from a set of arrays and objects of any nested filter or query body.
Build
Clone this repository
git clone git@github.com:dastanaron/gql-query-generator.git
Go to folder
cd js-graphql-query-builder
and run command
yarn installyarn run build
You can also npm
for build and install ependencies
Install
You can install old version with npm
npm install js-graphql-query-lib
Params
let Query = 'Alias' filter select;
Alias - Database index; filter - filter (must be Object) select - query body (must be an array with nested objects)
Example
const QueryBuilder = default; let filter = lang: 'en' id: 755 DateOfBirth: "2018-04-23 00:00:00" "2018-04-23 23:59:59" favorites: true; let select = 'id' account: 'bill' 'transaction' 'country' 'name' passport: placeofissue: 'country' 'city' 'seria' 'number' ; let QueryObject = 'User' filter select; console;
output:
{User(lang: "en", id: 755, DateOfBirth: ["2018-04-23 00:00:00", "2018-04-23 23:59:59"], favorites: true){id account{bill transaction country } name passport{placeofissue{country city } seria number } }}
See example.js
node example.js
example to RunKit