pub trait OptionalEmptyChangesetExtension<T> {
// Required method
fn optional_empty_changeset(self) -> Result<Option<T>, Error>;
}
Expand description
See the method documentation.
Required Methods§
Sourcefn optional_empty_changeset(self) -> Result<Option<T>, Error>
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
.
§Example
use diesel::{QueryResult, OptionalEmptyChangesetExtension, result::Error::QueryBuilderError, result::EmptyChangeset};
let result: QueryResult<i32> = Err(QueryBuilderError(Box::new(EmptyChangeset)));
assert_eq!(Ok(None), result.optional_empty_changeset());