Database

Struct Database 

Source
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

Source

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?;
Source

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.

Source

pub fn path(&self) -> &Path

Get the database path

Source

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")?;
Source

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.

Source

pub async fn execute_sql(&self, _query: &str) -> Result<QueryResult>

Execute a SQL query (stub for now)

Source

pub async fn execute_cypher(&self, _query: &str) -> Result<QueryResult>

Execute a Cypher query (stub for now)

Source

pub async fn execute_custom( &self, language: &str, query: &str, ) -> Result<QueryResult>

Execute a custom language query

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.