[−][src]Struct sqlx::postgres::types::PgMoney
postgres
only.The PostgreSQL MONEY
type stores a currency amount with a fixed fractional
precision. The fractional precision is determined by the database's
lc_monetary
setting.
Data is read and written as 64-bit signed integers, and conversion into a decimal should be done using the right precision.
Reading MONEY
value in text format is not supported and will cause an error.
Implementations
impl PgMoney
[src]
pub fn to_bigdecimal(self, scale: i64) -> BigDecimal
[src]
Convert the money value into a BigDecimal
using the correct
precision defined in the PostgreSQL settings. The default precision is
two.
pub fn to_decimal(self, scale: u32) -> Decimal
[src]
Convert the money value into a Decimal
using the correct precision
defined in the PostgreSQL settings. The default precision is two.
pub fn from_decimal(decimal: Decimal, scale: u32) -> PgMoney
[src]
Convert a Decimal
value into money using the correct precision
defined in the PostgreSQL settings. The default precision is two.
Conversion may involve a loss of precision.
pub fn from_bigdecimal(
decimal: BigDecimal,
scale: u32
) -> Result<PgMoney, Box<dyn Error + 'static + Sync + Send, Global>>
[src]
decimal: BigDecimal,
scale: u32
) -> Result<PgMoney, Box<dyn Error + 'static + Sync + Send, Global>>
Convert a BigDecimal
value into money using the correct precision
defined in the PostgreSQL settings. The default precision is two.
Trait Implementations
impl Add<PgMoney> for PgMoney
[src]
type Output = PgMoney
The resulting type after applying the +
operator.
pub fn add(self, rhs: PgMoney) -> <PgMoney as Add<PgMoney>>::Output
[src]
impl AddAssign<PgMoney> for PgMoney
[src]
pub fn add_assign(&mut self, rhs: PgMoney)
[src]
impl Clone for PgMoney
[src]
impl Copy for PgMoney
[src]
impl Debug for PgMoney
[src]
impl<'_> Decode<'_, Postgres> for PgMoney
[src]
pub fn decode(
value: PgValueRef<'_>
) -> Result<PgMoney, Box<dyn Error + 'static + Sync + Send, Global>>
[src]
value: PgValueRef<'_>
) -> Result<PgMoney, Box<dyn Error + 'static + Sync + Send, Global>>
impl<'_> Encode<'_, Postgres> for PgMoney
[src]
pub fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
[src]
fn size_hint(&self) -> usize
[src]
impl Eq for PgMoney
[src]
impl<T> From<T> for PgMoney where
T: Into<i64>,
[src]
T: Into<i64>,
impl PartialEq<PgMoney> for PgMoney
[src]
impl StructuralEq for PgMoney
[src]
impl StructuralPartialEq for PgMoney
[src]
impl Sub<PgMoney> for PgMoney
[src]
type Output = PgMoney
The resulting type after applying the -
operator.
pub fn sub(self, rhs: PgMoney) -> <PgMoney as Sub<PgMoney>>::Output
[src]
impl SubAssign<PgMoney> for PgMoney
[src]
pub fn sub_assign(&mut self, rhs: PgMoney)
[src]
impl Type<Postgres> for PgMoney
[src]
pub fn type_info() -> PgTypeInfo
[src]
fn compatible(ty: &<DB as Database>::TypeInfo) -> bool
[src]
Auto Trait Implementations
impl RefUnwindSafe for PgMoney
impl Send for PgMoney
impl Sync for PgMoney
impl Unpin for PgMoney
impl UnwindSafe for PgMoney
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,