0.1.5 • Published 3 years ago

graphile-query v0.1.5

Weekly downloads
16
License
SEE LICENSE IN LI...
Repository
github
Last release
3 years ago

graphile-query

npm install graphile-query

usage

Use as a particular role, skipping any auth logic

const results = await client.query({
    role: 'postgres',
    query,
    variables
});

Or pass a request object to be evaluated based on logic

const results = await client.query({
    req: { something: { special: 'e90829ef-1da4-448d-3e44-b3d275702b86' } },
    query: MyGraphQLQuery,
    variables
});

initialization

import { GraphileQuery, getSchema } from 'graphile-query';

// get the pg pool
const pool = getRootPgPool();

// get Graphile Settings
const settings = getGraphileSettings({
    schema: [SCHEMA_NAME],
    pgSettings (req) {
        // custom logic for requests
        return { role: 'public' };
    }
});

// get schema
const schema = await getSchema(pool, settings);

// initialize client
const client = new GraphileQuery({ schema, pool, settings });
0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago