Skip to main content

Database

Struct Database 

Source
pub struct Database<D, E> { /* private fields */ }

Implementations§

Source§

impl<D, E> Database<D, E>
where D: Dialect, E: Executor,

Source

pub const fn new(dialect: D, executor: E) -> Self

Source

pub fn dialect(&self) -> &D

Source

pub fn executor(&self) -> &E

Source

pub fn compile<Q: Query>(&self, query: Q) -> Result<CompiledQuery>

Source

pub async fn execute<Q: Query>( &self, query: Q, ) -> Result<ExecuteResult, DatabaseError<E::Error>>

Source

pub async fn fetch_all<Q: Query>( &self, query: Q, ) -> Result<QueryResult<E::Row>, DatabaseError<E::Error>>

Source

pub async fn fetch_optional<Q: Query>( &self, query: Q, ) -> Result<Option<E::Row>, DatabaseError<E::Error>>

Source

pub async fn fetch_one<Q: Query>( &self, query: Q, ) -> Result<E::Row, DatabaseError<E::Error>>

Source

pub async fn fetch_all_as<Q>( &self, query: Q, ) -> Result<QueryResult<Q::Output>, DatabaseError<E::Error>>
where Q: Query, Q::Output: FromRow, E::Row: Row,

Source

pub async fn fetch_optional_as<Q>( &self, query: Q, ) -> Result<Option<Q::Output>, DatabaseError<E::Error>>
where Q: Query, Q::Output: FromRow, E::Row: Row,

Source

pub async fn fetch_one_as<Q>( &self, query: Q, ) -> Result<Q::Output, DatabaseError<E::Error>>
where Q: Query, Q::Output: FromRow, E::Row: Row,

Source

pub fn into_parts(self) -> (D, E)

Trait Implementations§

Source§

impl<D: Debug, E: Debug> Debug for Database<D, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D, E> Freeze for Database<D, E>
where D: Freeze, E: Freeze,

§

impl<D, E> RefUnwindSafe for Database<D, E>

§

impl<D, E> Send for Database<D, E>
where D: Send, E: Send,

§

impl<D, E> Sync for Database<D, E>
where D: Sync, E: Sync,

§

impl<D, E> Unpin for Database<D, E>
where D: Unpin, E: Unpin,

§

impl<D, E> UnsafeUnpin for Database<D, E>
where D: UnsafeUnpin, E: UnsafeUnpin,

§

impl<D, E> UnwindSafe for Database<D, E>
where D: UnwindSafe, E: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SqlComparable<Option<T>> for T

Source§

impl<T> SqlComparable<T> for T

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.