I think it will be less verbose if FQL had a Pipe method. Is this in the roadmap?
HI @vasco3, We’re looking onto a redesign of the query language and simplifiy the syntax while preserving it’s composability. We have been looking into using method chaining as a means to reduce the vebosity of FQL, which is in some regards similar to a piping, although not exactly the same.
pipe(Var('foo'), Get, Select(['data', 'bar']))
So I already started. It looks great.
Select( ['data', 'owner'], Get(Select(['data', 'thing'], Get(Var('askRef')))), ),
_( _Var('askRef'), _Get, _Select(['data', 'thing']), _Get, _Select(['data', 'owner']), ), // Another example If( _(Var('ask'), _Exists), _(Var('ask'), _Get, _Select('ref'), ViewerDelete), null ),
All we need is:
// Pipeable FQL const _ = pipe; const _Var = Var; const _Get = (ref: ExprArg) => Get(ref); const _GetWithTS = (ts: ExprArg) => (ref: ExprArg) => Get(ref, ts); const _Select = (path: ExprArg, _default?: ExprArg) => (from: ExprArg) => _default === undefined ? Select(path, from) : Select(path, from, _default); const _Exists = (ref: ExprArg) => Exists(ref);