Dgraph QueryBuilder written in TypeScript

Hey guys.

Just published QueryBuilder for Dgraph written in TypeScript, hope you like it :slight_smile:

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.

12 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.