pub struct GraphLite { /* private fields */ }Expand description
Main entry point for GraphLite database operations
Represents an open connection to a GraphLite database. Despite being an embedded database, we use “Connection” terminology following the SQLite convention as it represents the connection to the database files.
§Examples
use graphlite_sdk::GraphLite;
// Open a database
let db = GraphLite::open("./mydb")?;
// Create a session for a user
let session = db.session("admin")?;
// Execute a query
let result = session.query("MATCH (n:Person) RETURN n")?;Implementations§
Source§impl GraphLite
impl GraphLite
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open a GraphLite database at the given path
Creates or opens a database at the specified path and initializes all necessary components. This is the main entry point for working with GraphLite databases.
§Arguments
path- Path to the database directory
§Examples
use graphlite_sdk::GraphLite;
let db = GraphLite::open("./mydb")?;Sourcepub fn session(&self, username: &str) -> Result<Session>
pub fn session(&self, username: &str) -> Result<Session>
Create a new session for the given user
Sessions provide user context for permissions and security. Each session maintains its own transaction state and is isolated from other sessions.
Unlike SQLite which doesn’t have sessions, GraphLite uses sessions for:
- User authentication and permissions
- Transaction isolation
- Audit logging
§Arguments
username- Username for the session
§Examples
let session = db.session("admin")?;Sourcepub fn coordinator(&self) -> &QueryCoordinator
pub fn coordinator(&self) -> &QueryCoordinator
Get access to the underlying QueryCoordinator
Provides direct access to the low-level API when needed for advanced operations not yet covered by the SDK.
§Safety
This is an escape hatch for advanced users. Most applications should use the high-level SDK API instead.