pub struct WasmDbmsDatabase<'ctx, M>where
M: MemoryProvider,{ /* private fields */ }Expand description
The main DBMS database struct, generic over MemoryProvider.
This struct borrows from a DbmsContext and provides all CRUD
operations, transaction management, and query execution.
Implementations§
Source§impl<'ctx, M> WasmDbmsDatabase<'ctx, M>where
M: MemoryProvider,
impl<'ctx, M> WasmDbmsDatabase<'ctx, M>where
M: MemoryProvider,
Sourcepub fn oneshot(
ctx: &'ctx DbmsContext<M>,
schema: impl DatabaseSchema<M> + 'ctx,
) -> Self
pub fn oneshot( ctx: &'ctx DbmsContext<M>, schema: impl DatabaseSchema<M> + 'ctx, ) -> Self
Creates a one-shot (non-transactional) database instance.
Sourcepub fn from_transaction(
ctx: &'ctx DbmsContext<M>,
schema: impl DatabaseSchema<M> + 'ctx,
transaction_id: TransactionId,
) -> Self
pub fn from_transaction( ctx: &'ctx DbmsContext<M>, schema: impl DatabaseSchema<M> + 'ctx, transaction_id: TransactionId, ) -> Self
Creates a transactional database instance.
Trait Implementations§
Source§impl<M> Database for WasmDbmsDatabase<'_, M>where
M: MemoryProvider,
impl<M> Database for WasmDbmsDatabase<'_, M>where
M: MemoryProvider,
Source§fn select<T>(&self, query: Query) -> DbmsResult<Vec<T::Record>>where
T: TableSchema,
fn select<T>(&self, query: Query) -> DbmsResult<Vec<T::Record>>where
T: TableSchema,
Source§fn select_raw(
&self,
table: &str,
query: Query,
) -> DbmsResult<Vec<Vec<(ColumnDef, Value)>>>
fn select_raw( &self, table: &str, query: Query, ) -> DbmsResult<Vec<Vec<(ColumnDef, Value)>>>
Runs a
SELECT against a table identified by name, returning raw
column-value pairs instead of typed records. Read moreSource§fn select_join(&self, table: &str, query: Query) -> DbmsResult<JoinResultSet>
fn select_join(&self, table: &str, query: Query) -> DbmsResult<JoinResultSet>
Runs a join query starting from
table. Read moreSource§fn aggregate<T>(
&self,
query: Query,
aggregates: &[AggregateFunction],
) -> DbmsResult<Vec<AggregatedRow>>where
T: TableSchema,
fn aggregate<T>(
&self,
query: Query,
aggregates: &[AggregateFunction],
) -> DbmsResult<Vec<AggregatedRow>>where
T: TableSchema,
Runs an aggregate query for table
T, computing the requested
aggregate functions per group. Read moreSource§fn insert<T>(&self, record: T::Insert) -> DbmsResult<()>
fn insert<T>(&self, record: T::Insert) -> DbmsResult<()>
Inserts a single record into table
T. Read moreSource§fn delete<T>(
&self,
behaviour: DeleteBehavior,
filter: Option<Filter>,
) -> DbmsResult<u64>where
T: TableSchema,
fn delete<T>(
&self,
behaviour: DeleteBehavior,
filter: Option<Filter>,
) -> DbmsResult<u64>where
T: TableSchema,
Source§fn commit(&mut self) -> DbmsResult<()>
fn commit(&mut self) -> DbmsResult<()>
Commits the active transaction, replaying its operations against
stable storage under a single write-ahead journal. Read more
Source§fn rollback(&mut self) -> DbmsResult<()>
fn rollback(&mut self) -> DbmsResult<()>
Discards every staged operation in the active transaction without
touching stable storage, and consumes the transaction handle. Read more
Source§fn has_drift(&self) -> DbmsResult<bool>
fn has_drift(&self) -> DbmsResult<bool>
Returns
true iff the compiled schema differs from the snapshots
persisted in stable memory. Read moreSource§fn pending_migrations(&self) -> DbmsResult<Vec<MigrationOp>>
fn pending_migrations(&self) -> DbmsResult<Vec<MigrationOp>>
Returns the migration ops needed to bring the on-disk schema in line
with the compiled schema, without applying anything. Read more
Source§fn migrate(&mut self, policy: MigrationPolicy) -> DbmsResult<()>
fn migrate(&mut self, policy: MigrationPolicy) -> DbmsResult<()>
Applies a planned migration under
policy. Read moreAuto Trait Implementations§
impl<'ctx, M> !RefUnwindSafe for WasmDbmsDatabase<'ctx, M>
impl<'ctx, M> !Send for WasmDbmsDatabase<'ctx, M>
impl<'ctx, M> !Sync for WasmDbmsDatabase<'ctx, M>
impl<'ctx, M> !UnwindSafe for WasmDbmsDatabase<'ctx, M>
impl<'ctx, M> Freeze for WasmDbmsDatabase<'ctx, M>
impl<'ctx, M> Unpin for WasmDbmsDatabase<'ctx, M>
impl<'ctx, M> UnsafeUnpin for WasmDbmsDatabase<'ctx, M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more