pub struct Database { /* private fields */ }Expand description
Database connection wrapper
Wraps a Manifold ColumnFamilyDatabase and provides query execution methods. This is the main entry point for generated code.
§Architecture
- Each schema becomes a column family in Manifold
- Properties stored via manifold-properties (typed, temporal)
- Relationships stored via manifold-graph (bidirectional edges)
- Vectors stored via manifold-vectors (zero-copy access)
§Thread Safety
Database is Send + Sync and can be shared across async tasks.
Implementations§
Source§impl Database
impl Database
Sourcepub async fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub async fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open a database connection
Creates or opens a Manifold database at the specified path.
§Example
let db = Database::open("./data/app.manifold").await?;Sourcepub async fn close(self) -> Result<()>
pub async fn close(self) -> Result<()>
Close the database connection
Explicitly closes the connection and flushes any pending writes. The database is automatically closed when dropped.
Sourcepub fn collection(&self, name: &str) -> Result<Collection>
pub fn collection(&self, name: &str) -> Result<Collection>
Get a collection (column family) for a schema
This is the primary method used by generated code to access schema storage.
§Example
let users_collection = db.collection("users")?;Sourcepub async fn execute_hyperql(&self, _query: &str) -> Result<QueryResult>
pub async fn execute_hyperql(&self, _query: &str) -> Result<QueryResult>
Execute a HyperQL query (stub for now)
This will be implemented when HyperQL compiler is integrated.
Sourcepub async fn execute_sql(&self, _query: &str) -> Result<QueryResult>
pub async fn execute_sql(&self, _query: &str) -> Result<QueryResult>
Execute a SQL query (stub for now)
Sourcepub async fn execute_cypher(&self, _query: &str) -> Result<QueryResult>
pub async fn execute_cypher(&self, _query: &str) -> Result<QueryResult>
Execute a Cypher query (stub for now)
Sourcepub async fn execute_custom(
&self,
language: &str,
query: &str,
) -> Result<QueryResult>
pub async fn execute_custom( &self, language: &str, query: &str, ) -> Result<QueryResult>
Execute a custom language query