Skip to content

Nested fragment fields with arguments are here + refactoring + readme

Pre-release
Pre-release
Compare
Choose a tag to compare
@mrspartak mrspartak released this 25 May 08:14
· 120 commits to master since this release
const fragment2 = new Fragment({
    table: 'test',
    name: 'with_nested_args',
    fields: [
        'id',
        [
            'logo',
            ['url'],
            {
                _table: 'images',
                limit: 'logo_limit',
                offset: 'logo_offset',
                where: 'logo_where',
                order_by: 'logo_order_by',
                distinct_on: 'logo_distinct_on',
            },
        ],
    ],
});

/* 
This will generate such fragment

Fragment with_nested_args_fragment_test on test {
    id
    logo (limit: $logo_limit, ...) {
        url
    }
}
*/

await orm.query({
    test: {
        fragment: 'with_nested_args',
        variables: {
            'logo_limit': 1
        }
    }
})