tql
tql copied to clipboard
Named fragment API
Possible API:
// or class-based API
const userName = new Fragment({
name: 'UserDetails',
on: 'User',
selection: (t) => [ t.name(t => [ t.first(), t.last() ]) ]
})
// higher-level functional API
const userName = on('User', t => [ t.name(t => [ t.first(), t.last() ])).named('UserNameFields')
// or
const userName = user(t => [ t.name(t => [ t.first(), t.last() ])).toFragment('UserNameFields')