pub struct Db<'a, Q: ?Sized> { /* private fields */ }Expand description
Typed access to the database, over the adapter or a transaction.
Implementations§
Source§impl<'a, Q: Queries + ?Sized> Db<'a, Q>
impl<'a, Q: Queries + ?Sized> Db<'a, Q>
pub fn new(queries: &'a Q, schema: &'a Schema) -> Self
pub fn schema(&self) -> &'a Schema
pub fn raw(&self) -> &'a Q
pub fn find<M: Model>(&self, filter: Where<M>) -> Find<'a, Q, M>
pub async fn insert<M: Model>(&self, model: &M) -> DbResult<M>
Sourcepub async fn insert_row<M: Model>(
&self,
values: Vec<(&str, Value)>,
) -> DbResult<Row>
pub async fn insert_row<M: Model>( &self, values: Vec<(&str, Value)>, ) -> DbResult<Row>
Inserts raw column values into M’s table, filling defaults. Returns the stored row.
pub fn update<M: Model>(&self, filter: Where<M>) -> UpdateBuilder<'a, Q, M>
pub async fn delete<M: Model>(&self, filter: Where<M>) -> DbResult<u64>
pub async fn count<M: Model>(&self, filter: Where<M>) -> DbResult<u64>
Trait Implementations§
Auto Trait Implementations§
impl<'a, Q> Forget for Db<'a, Q>where
Q: ?Sized,
impl<'a, Q> Freeze for Db<'a, Q>
impl<'a, Q> Move for Db<'a, Q>where
Q: ?Sized,
impl<'a, Q> RefUnwindSafe for Db<'a, Q>
impl<'a, Q> Send for Db<'a, Q>
impl<'a, Q> Sync for Db<'a, Q>
impl<'a, Q> Unpin for Db<'a, Q>
impl<'a, Q> UnsafeUnpin for Db<'a, Q>
impl<'a, Q> UnwindSafe for Db<'a, Q>
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