diesel::prelude

Type Alias QueryResult

Source
pub type QueryResult<T> = Result<T, Error>;
Expand description

A specialized result type for queries.

This type is exported by diesel::prelude, and is generally used by any code which is interacting with Diesel. This type exists to avoid writing out diesel::result::Error, and is otherwise a direct mapping to Result.

Aliased Type§

enum QueryResult<T> {
    Ok(T),
    Err(Error),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Error)

Contains the error value

Trait Implementations§

Source§

impl<T> OptionalEmptyChangesetExtension<T> for QueryResult<T>

Source§

fn optional_empty_changeset(self) -> Result<Option<T>, Error>

By default, Diesel treats an empty update as a QueryBuilderError. This method will convert that error into None. Read more
Source§

impl<T> OptionalExtension<T> for QueryResult<T>

Source§

fn optional(self) -> Result<Option<T>, Error>

Converts a QueryResult<T> into a QueryResult<Option<T>>. Read more
Source§

impl<S, C> StatementCallbackReturnType<S, C> for QueryResult<S>
where S: 'static,

Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Source§

type Return<'a> = Result<MaybeCached<'a, S>, Error>

The return type of StatementCache::cached_statement Read more
Source§

fn from_error<'a>(e: Error) -> Self::Return<'a>

Create the return type from an error
Source§

fn map_to_no_cache<'a>(self) -> Self::Return<'a>

Map the callback return type to the MaybeCached::CannotCache variant
Source§

fn map_to_cache(stmt: &mut S, _conn: C) -> Self::Return<'_>

Map the cached statement to the MaybeCached::Cached variant
Source§

fn register_cache<'a>( self, callback: impl FnOnce(S) -> &'a mut S + Send + 'a, ) -> Self::Return<'a>
where Self: 'a,

Insert the created statement into the cache via the provided callback and then turn the returned reference into MaybeCached::Cached