#[non_exhaustive]pub enum AnyQueryResult {
Postgres(PgQueryResult),
MySql(MySqlQueryResult),
Sqlite(SqliteQueryResult),
}Expand description
The result of a write on a connection of any enabled backend: its affected-row count and last inserted ID.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Postgres(PgQueryResult)
PostgreSQL completion metadata.
MySql(MySqlQueryResult)
MySQL completion metadata.
Sqlite(SqliteQueryResult)
SQLite completion metadata.
Implementations§
Source§impl AnyQueryResult
impl AnyQueryResult
Sourcepub fn rows_affected(&self) -> u64
pub fn rows_affected(&self) -> u64
Return the number of rows the statement affected, as the database reports it.
Sourcepub fn last_insert_id(&self) -> Result<Option<i64>, Error>
pub fn last_insert_id(&self) -> Result<Option<i64>, Error>
Return the ID of the last row an insert created. Read it only from an insert’s result.
PostgreSQL returns None, so use RETURNING there. MySQL returns None when the insert
generated no ID. SQLite returns the connection’s last inserted rowid, even when this statement
inserted nothing.
§Errors
Returns an error for a MySQL ID above i64::MAX. Match the MySql variant to read it.
Trait Implementations§
Source§impl Debug for AnyQueryResult
impl Debug for AnyQueryResult
Source§impl From<MySqlQueryResult> for AnyQueryResult
Available on crate feature database-mysql only.
impl From<MySqlQueryResult> for AnyQueryResult
Available on crate feature
database-mysql only.Source§fn from(value: MySqlQueryResult) -> AnyQueryResult
fn from(value: MySqlQueryResult) -> AnyQueryResult
Converts to this type from the input type.
Source§impl From<PgQueryResult> for AnyQueryResult
Available on crate feature database-postgres only.
impl From<PgQueryResult> for AnyQueryResult
Available on crate feature
database-postgres only.Source§fn from(value: PgQueryResult) -> AnyQueryResult
fn from(value: PgQueryResult) -> AnyQueryResult
Converts to this type from the input type.
Source§impl From<SqliteQueryResult> for AnyQueryResult
Available on crate feature database-sqlite only.
impl From<SqliteQueryResult> for AnyQueryResult
Available on crate feature
database-sqlite only.Source§fn from(value: SqliteQueryResult) -> AnyQueryResult
fn from(value: SqliteQueryResult) -> AnyQueryResult
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for AnyQueryResult
impl Freeze for AnyQueryResult
impl Move for AnyQueryResult
impl RefUnwindSafe for AnyQueryResult
impl Send for AnyQueryResult
impl Sync for AnyQueryResult
impl Unpin for AnyQueryResult
impl UnsafeUnpin for AnyQueryResult
impl UnwindSafe for AnyQueryResult
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.