@jakeboone02/graphlite-node
v0.0.3
Published
Node.js bindings for GraphLite embedded graph database (ISO GQL)
Downloads
10
Maintainers
Readme
GraphLite Node.js Bindings
Node.js bindings for GraphLite, an embedded graph database with ISO GQL support.
Prerequisites
- Rust toolchain (for building from source)
- Node.js >= 18 or Bun
Usage
import { GraphLiteDB } from '@jakeboone02/graphlite-node';
const db = GraphLiteDB.open('./mydb');
const session = db.createSession('admin');
session.execute("CREATE SCHEMA /myschema");
session.execute("CREATE GRAPH /myschema/social");
session.execute("SESSION SET GRAPH /myschema/social");
session.execute("INSERT (:Person {name: 'Alice', age: 30})");
const result = session.query("MATCH (p:Person) RETURN p.name, p.age");
console.log(result.rows);
// [{ "p.name": "Alice", "p.age": 30 }]
session.close();
db.close();API
GraphLiteDB
static open(path: string): GraphLiteDB— Open or create a databasecreateSession(username: string): GraphLiteSession— Create a sessionclose(): void— Close the database
GraphLiteSession
query(gql: string): QueryResult— Execute a GQL query and return resultsexecute(gql: string): void— Execute a GQL statement (no results)close(): void— Close the session
QueryResult
interface QueryResult {
variables: string[];
rows: Record<string, unknown>[];
rowCount: number;
}Development
# Install JS dependencies
bun install
# Build the native addon (requires Rust)
bun run build
# Run tests
bun testLicense
MIT
