API ReferenceOverview

API Reference

CypherLite provides APIs across multiple languages. Each binding exposes the same core functionality: opening a database, executing Cypher queries, and iterating over results.

Rust API (Primary)

The Rust API is the primary interface and provides the most complete feature set.

Full Rust API documentation with all type signatures and examples is available on docs.rs/cypherlite-query.

Core Types

TypeDescription
CypherLiteMain database handle. Open, execute queries, and manage the database lifecycle.
QueryResultIterator over result rows returned by execute().
RowA single result row with column access via get(name).
ValueTyped property value: Null, Bool, Int64, Float64, String, Bytes, Array.
CypherLiteErrorError type for all database operations.

Core Methods

// Open or create a database
let db = CypherLite::open("path/to/db.cyl")?;
 
// Execute a Cypher query
let result = db.execute("MATCH (n) RETURN n")?;
 
// Iterate over results
for row in result {
    let row = row?;
    let value = row.get("column_name");
}

Crate Hierarchy

CratePurpose
cypherlite-queryHigh-level query interface (recommended entry point)
cypherlite-coreCore data structures, traits, and plugin system
cypherlite-storageStorage engine, B+Tree, WAL, buffer pool
cypherlite-ffiC ABI foreign function interface

FFI Binding APIs

All FFI bindings follow a consistent pattern:

  1. Open a database from a file path
  2. Execute Cypher queries as strings
  3. Iterate over result rows
  4. Close the database handle

Python API

import cypherlite
 
db = cypherlite.open("db.cyl")         # Open database
result = db.execute("MATCH (n) ...")    # Execute query
for row in result:                       # Iterate rows
    print(row["column"])                 # Access columns
db.close()                               # Close database

See the Python Getting Started guide for full details.

Go API

db, err := cypherlite.Open("db.cyl")    // Open database
result, err := db.Execute("MATCH ...")   // Execute query
for result.Next() {                       // Iterate rows
    row := result.Row()
    val, _ := row.GetString("column")    // Access columns
}
db.Close()                                // Close database

See the Go Getting Started guide for full details.

Node.js API

const { open } = require("cypherlite");
const db = open("db.cyl");              // Open database
const result = db.execute("MATCH ..."); // Execute query
for (const row of result) {              // Iterate rows
  console.log(row["column"]);            // Access columns
}
db.close();                              // Close database

See the Node.js Getting Started guide for full details.

C API

#include "cypherlite.h"
 
CylDb *db = cyl_open("db.cyl");                // Open database
CylResult *res = cyl_execute(db, "MATCH ..."); // Execute query
while (cyl_result_next(res)) {                  // Iterate rows
    const char *val = cyl_row_get_string(res, "column");
}
cyl_result_free(res);                           // Free result
cyl_close(db);                                  // Close database

The C header (cypherlite.h) and static library (libcypherlite_ffi.a) are generated by building the cypherlite-ffi crate.

Property Types

All bindings support the same set of property value types:

TypeRustPythonGoNode.jsC
NullValue::NullNonenilnullCYL_NULL
BooleanValue::Boolboolboolbooleancyl_bool
IntegerValue::Int64intint64numberint64_t
FloatValue::Float64floatfloat64numberdouble
StringValue::Stringstrstringstringconst char*
BytesValue::Bytesbytes[]byteBufferuint8_t*
ArrayValue::Arraylist[]anyArrayCylArray*