Hey guys.
Just published QueryBuilder for Dgraph written in TypeScript, hope you like it
Demo:
import { query, edge } from '@dgraphium/core';
import { uid, regex, gt, gte, lt, and, or } from '@dgraphium/core/operators';
const meQuery = query()
.name('me')
.func(uid('0x2', '0x3', '0x4'))
.filter(and(
or(
regex('name', /zura/i),
regex('name', /benashvili/i),
),
gte('age', 15),
lt('age', 25)
))
.project({
id: 1, // uid = id
name: 1,
age: 1,
posts: edge({
id: 1,
text: 1,
})
.filter(gt('createdDate', new Date('2020-01-01')))
.first(10),
})
.first(1)
For more examples check the npm package or github link.