0.1.13 • Published 2 years ago
graphcontrol v0.1.13
Graphcontrol
Graphcontrol is a OGM for Neo4j. It is intended for use in TypeScript, so you don't have to know any Cypher in order to query a Neo4j Database. This library isn't really suited for more complex Cypher Queries.
Installation
It can be installed via npm.
npm i graphcontrol
API
Setting up a Schema
const provider = new Neo4jProvider({
url: "bolt://localhost:7687",
username: "neo4j",
password: "password"
});
type PersonProps = {
name: string;
age: number;
}
const Person = new Schema<PersonProps>(provider, "Person");
Relations can be defined the following way:
const relations = [{
id: "car", //id to reference by
schema: "Car", //label of the targeted Schema
label: "OWNS", //relation label, e.g. ()-[:OWNS]->()
direction: "to" //relation direction
}];
const PersonWithRelations = new Schema<PersonProps>(provider, "Person", relations);
getting nodes of a Schema
//all Nodes
await Person.getNodes();
//Person by Name
await Person.getNodes({where: {name: "John"}});
//find People named John and optionally their blue car(s)
await Person.getNodes({
where: {name: "John"},
relations: [{
id: "car",
where: {color: "blue"}
}]
});
WIP
0.1.13
2 years ago
0.1.12
3 years ago
0.1.11
3 years ago
0.1.10
3 years ago
0.1.0
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.8
3 years ago
0.0.9
3 years ago
0.1.7
3 years ago
0.0.8
3 years ago
0.1.9
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago