Skip to main content

WasmDbmsDatabase

Struct WasmDbmsDatabase 

Source
pub struct WasmDbmsDatabase<'ctx, M, A = AccessControlList>{ /* private fields */ }
Expand description

The main DBMS database struct, generic over MemoryProvider and AccessControl.

This struct borrows from a DbmsContext and provides all CRUD operations, transaction management, and query execution.

Implementations§

Source§

impl<'ctx, M, A> WasmDbmsDatabase<'ctx, M, A>

Source

pub fn oneshot( ctx: &'ctx DbmsContext<M, A>, schema: impl DatabaseSchema<M, A> + 'ctx, ) -> Self

Creates a one-shot (non-transactional) database instance.

Source

pub fn from_transaction( ctx: &'ctx DbmsContext<M, A>, schema: impl DatabaseSchema<M, A> + 'ctx, transaction_id: TransactionId, ) -> Self

Creates a transactional database instance.

Trait Implementations§

Source§

impl<M, A> Database for WasmDbmsDatabase<'_, M, A>

Source§

fn select<T>(&self, query: Query) -> DbmsResult<Vec<T::Record>>
where T: TableSchema,

Executes a SELECT query and returns the results. Read more
Source§

fn select_raw( &self, table: &str, query: Query, ) -> DbmsResult<Vec<Vec<(ColumnDef, Value)>>>

Executes a generic SELECT and returns raw column-value pairs. Read more
Source§

fn insert<T>(&self, record: T::Insert) -> DbmsResult<()>
where T: TableSchema, T::Insert: InsertRecord<Schema = T>,

Executes an INSERT query. Read more
Source§

fn update<T>(&self, patch: T::Update) -> DbmsResult<u64>
where T: TableSchema, T::Update: UpdateRecord<Schema = T>,

Executes an UPDATE query. Read more
Source§

fn delete<T>( &self, behaviour: DeleteBehavior, filter: Option<Filter>, ) -> DbmsResult<u64>
where T: TableSchema,

Executes a DELETE query. Read more
Source§

fn commit(&mut self) -> DbmsResult<()>

Commits the current transaction. Read more
Source§

fn rollback(&mut self) -> DbmsResult<()>

Rolls back the current transaction. Read more

Auto Trait Implementations§

§

impl<'ctx, M, A> Freeze for WasmDbmsDatabase<'ctx, M, A>

§

impl<'ctx, M, A = AccessControlList> !RefUnwindSafe for WasmDbmsDatabase<'ctx, M, A>

§

impl<'ctx, M, A = AccessControlList> !Send for WasmDbmsDatabase<'ctx, M, A>

§

impl<'ctx, M, A = AccessControlList> !Sync for WasmDbmsDatabase<'ctx, M, A>

§

impl<'ctx, M, A> Unpin for WasmDbmsDatabase<'ctx, M, A>

§

impl<'ctx, M, A> UnsafeUnpin for WasmDbmsDatabase<'ctx, M, A>

§

impl<'ctx, M, A = AccessControlList> !UnwindSafe for WasmDbmsDatabase<'ctx, M, A>

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.