pub struct WasmDbmsDatabase<'ctx, M, A = AccessControlList>where
M: MemoryProvider,
A: AccessControl,{ /* 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>where
M: MemoryProvider,
A: AccessControl,
impl<'ctx, M, A> WasmDbmsDatabase<'ctx, M, A>where
M: MemoryProvider,
A: AccessControl,
Sourcepub fn oneshot(
ctx: &'ctx DbmsContext<M, A>,
schema: impl DatabaseSchema<M, A> + 'ctx,
) -> Self
pub fn oneshot( ctx: &'ctx DbmsContext<M, A>, schema: impl DatabaseSchema<M, A> + 'ctx, ) -> Self
Creates a one-shot (non-transactional) database instance.
Sourcepub fn from_transaction(
ctx: &'ctx DbmsContext<M, A>,
schema: impl DatabaseSchema<M, A> + 'ctx,
transaction_id: TransactionId,
) -> Self
pub fn from_transaction( ctx: &'ctx DbmsContext<M, A>, schema: impl DatabaseSchema<M, A> + 'ctx, transaction_id: TransactionId, ) -> Self
Creates a transactional database instance.
Sourcepub fn granted(
&self,
id: &A::Id,
table: TableFingerprint,
required: TablePerms,
) -> bool
pub fn granted( &self, id: &A::Id, table: TableFingerprint, required: TablePerms, ) -> bool
Returns whether id is granted required on table.
Sourcepub fn granted_admin(&self, id: &A::Id) -> bool
pub fn granted_admin(&self, id: &A::Id) -> bool
Returns whether id carries the admin bypass flag.
Sourcepub fn granted_manage_acl(&self, id: &A::Id) -> bool
pub fn granted_manage_acl(&self, id: &A::Id) -> bool
Returns whether id carries the manage_acl flag.
Sourcepub fn granted_migrate(&self, id: &A::Id) -> bool
pub fn granted_migrate(&self, id: &A::Id) -> bool
Returns whether id carries the migrate flag.
Sourcepub fn grant(
&self,
caller: &A::Id,
target: A::Id,
grant: PermGrant,
) -> DbmsResult<()>
pub fn grant( &self, caller: &A::Id, target: A::Id, grant: PermGrant, ) -> DbmsResult<()>
Applies a grant on behalf of caller. Self-enforces manage_acl.
Sourcepub fn revoke(
&self,
caller: &A::Id,
target: &A::Id,
revoke: PermRevoke,
) -> DbmsResult<()>
pub fn revoke( &self, caller: &A::Id, target: &A::Id, revoke: PermRevoke, ) -> DbmsResult<()>
Applies a revoke on behalf of caller. Self-enforces manage_acl.
Sourcepub fn remove_identity(&self, caller: &A::Id, target: &A::Id) -> DbmsResult<()>
pub fn remove_identity(&self, caller: &A::Id, target: &A::Id) -> DbmsResult<()>
Removes target from the ACL on behalf of caller. Self-enforces
manage_acl.
Sourcepub fn identities(
&self,
caller: &A::Id,
) -> DbmsResult<Vec<(A::Id, IdentityPerms)>>
pub fn identities( &self, caller: &A::Id, ) -> DbmsResult<Vec<(A::Id, IdentityPerms)>>
Returns every identity in the ACL together with its perms, on
behalf of caller. Self-enforces manage_acl.
Trait Implementations§
Source§impl<M, A> Database for WasmDbmsDatabase<'_, M, A>where
M: MemoryProvider,
A: AccessControl,
impl<M, A> Database for WasmDbmsDatabase<'_, M, A>where
M: MemoryProvider,
A: AccessControl,
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)>>>
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<Vec<Vec<(JoinColumnDef, Value)>>>
fn select_join( &self, table: &str, query: Query, ) -> DbmsResult<Vec<Vec<(JoinColumnDef, Value)>>>
table, returning rows with
JoinColumnDef entries that carry the source table name. 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,
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<()>
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<()>
Source§fn rollback(&mut self) -> DbmsResult<()>
fn rollback(&mut self) -> DbmsResult<()>
Source§fn has_drift(&self) -> DbmsResult<bool>
fn has_drift(&self) -> DbmsResult<bool>
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>>
Source§fn migrate(&mut self, policy: MigrationPolicy) -> DbmsResult<()>
fn migrate(&mut self, policy: MigrationPolicy) -> DbmsResult<()>
policy. Read more