typed-neo4j
v0.1.0
Published
Neo4j driver with customizable schema for vertex and edge.
Downloads
3
Readme
Typed Neo4j
Neo4j driver with customizable schema for vertex and edge.
Example
You should define your schema first.
export interface User {
username: string;
name: string;
created: Date;
}
export interface Post {
title: string;
content: string;
created: Date;
updated: Date;
}
/** Other Vertex Schema ... */
export interface VertexSchema {
User: User;
Tag: Tag;
Post: Post;
Forum: Forum;
}
export interface EdgeSchema {
FOLLOWS: {
from: User;
to: User;
props: {
since: Date;
};
};
/** Other Edge Schema ... */
}
Then you can use it to create a db session.
const db = new DB<VertexSchema, EdgeSchema>();
Enjoy your typed db.create
, db.find
, db.update
, db.link
!
Please see example for more details.