pub struct Row(/* private fields */);Expand description
One result row. Read columns by name or position with Row::try_get.
Implementations§
Source§impl Row
impl Row
Source§impl Row
impl Row
Sourcepub fn try_get_money(
&self,
amount: &str,
currency: &str,
) -> Result<Money, DbError>
pub fn try_get_money( &self, amount: &str, currency: &str, ) -> Result<Money, DbError>
Reads a Money from two columns: the amount in minor units
(BIGINT) and its ISO 4217 code (TEXT). A code that is not a known
currency is a decode error.
let row = renox::db::sql("SELECT 1250 AS total, 'USD' AS total_currency")
.fetch_one(&db)
.await?;
let total = row.try_get_money("total", "total_currency")?;
assert_eq!(total, renox::money::Money::usd(1250));Sourcepub fn try_get_money_opt(
&self,
amount: &str,
currency: &str,
) -> Result<Option<Money>, DbError>
pub fn try_get_money_opt( &self, amount: &str, currency: &str, ) -> Result<Option<Money>, DbError>
Like Row::try_get_money for a nullable pair: None when both
columns are NULL, an error when only one of them is.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Row
impl !RefUnwindSafe for Row
impl Send for Row
impl Sync for Row
impl Unpin for Row
impl UnsafeUnpin for Row
impl UnwindSafe for Row
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more