ExtraHorizon / javascript-sdk

Extrahorizon Javascript SDK
https://docs.extrahorizon.com/javascript-sdk/
MIT License
4 stars 5 forks source link

RQL ergonomics #669

Open wwaaijer-exh opened 1 year ago

wwaaijer-exh commented 1 year ago

Longer term thingy.

Some lose notes:

wwaaijer-exh commented 2 months ago

Looking at pure character count, it might even be easier to export an Rql helper for the rqlbuilder.

// Internalize
find({ rql: q => q.eq('userId', userId) })
// V.s. helper
find({ rql: Rql.eq('userId', userId) })

Works nicer with sub-queries (like or/contains) as well?

// Internalize
find({ rql: (q) => q.contains('enlistment', subQ => subQ.or(
  subQ => subQ.eq('active', true).eq('groupId', groupId)),
  subQ => subQ.eq('active', false).eq('groupId', groupId2))
)})

// V.s. helper
find({ rql: Rql.contains('enlistment', Rql.or(
  Rql.eq('active', true).eq('groupId', groupId),
  Rql.eq('active', false).eq('groupId', groupId2)
)})