@dgql/builder
v1.1.0-alpha.4
Published
DGQL Query Builder
Downloads
3
Maintainers
Readme
@dgql/builder
DGQL Query Builder.
Getting Started
$ npm install @dgql/builder
Quick Start
const { Builder, node, property, edge } = require("@dgql/builder");
const builder = new Builder();
const [dgql, variables] = builder
.match({
user: node({ label: "User" })
.where({ name: property({ equal: "Dan" }) })
.project({
id: property(),
name: property(),
posts: edge({
type: "HAS_POST",
direction: "OUT",
node: node({ label: "Post" }),
}).project({
title: property(),
}),
}),
})
.return(["user"])
.build();
console.log(dgql);
/*
{
MATCH {
user @node(label: User) {
WHERE {
name(equal: "Dan")
}
PROJECT {
id
name
posts @edge(type: HAS_POST, direction: OUT) @node(label: Post) {
title
}
}
}
}
RETURN {
user
}
}
*/
Usage
For the best view browse the TCK tests
Licence
MIT