[][src]Struct diesel::pg::data_types::PgMoney

pub struct PgMoney(pub i64);

Money is represented in Postgres as a 64 bit signed integer. This struct is a dumb wrapper type, meant only to indicate the integer's meaning. The fractional precision of the value is determined by the lc_monetary setting of the database. This struct is re-exported as Cents as a convenient and conventional expression of a typical unit of 1/100th of currency. For other names or precisions, users might consider a differently named use of the PgMoney struct.

use diesel::data_types::PgMoney as Pence; // 1/100th unit of Pound
use diesel::data_types::PgMoney as Fils;  // 1/1000th unit of Dinar

Trait Implementations

impl<__ST, __DB> Queryable<__ST, __DB> for PgMoney where
    __DB: Backend,
    Self: FromSql<__ST, __DB>, 
[src]

type Row = Self

The Rust type you'd like to map from. Read more

impl FromSql<Money, Pg> for PgMoney[src]

impl<__ST, __DB> FromSqlRow<__ST, __DB> for PgMoney where
    __DB: Backend,
    Self: FromSql<__ST, __DB>, 
[src]

const FIELDS_NEEDED: usize[src]

The number of fields that this type will consume. Must be equal to the number of times you would call row.take() in build_from_row Read more

impl<'expr> AsExpression<Money> for &'expr PgMoney[src]

type Expression = Bound<Money, Self>

The expression being returned

impl<'expr> AsExpression<Nullable<Money>> for &'expr PgMoney[src]

type Expression = Bound<Nullable<Money>, Self>

The expression being returned

impl AsExpression<Money> for PgMoney[src]

type Expression = Bound<Money, Self>

The expression being returned

impl AsExpression<Nullable<Money>> for PgMoney[src]

type Expression = Bound<Nullable<Money>, Self>

The expression being returned

impl<__DB> ToSql<Nullable<Money>, __DB> for PgMoney where
    __DB: Backend,
    Self: ToSql<Money, __DB>, 
[src]

impl ToSql<Money, Pg> for PgMoney[src]

impl Ord for PgMoney[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialOrd<PgMoney> for PgMoney[src]

impl Clone for PgMoney[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<PgMoney> for PgMoney[src]

impl Eq for PgMoney[src]

impl Copy for PgMoney[src]

impl Debug for PgMoney[src]

impl Sub<PgMoney> for PgMoney[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, rhs: PgMoney) -> Self::Output[src]

Panics

Performs a checked subtraction, and will panic! on underflow in both debug and release.

impl Add<PgMoney> for PgMoney[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, rhs: PgMoney) -> Self::Output[src]

Panics

Performs a checked addition, and will panic! on overflow in both debug and release.

impl AddAssign<PgMoney> for PgMoney[src]

fn add_assign(&mut self, rhs: PgMoney)[src]

Panics

Performs a checked addition, and will panic! on overflow in both debug and release.

impl SubAssign<PgMoney> for PgMoney[src]

fn sub_assign(&mut self, rhs: PgMoney)[src]

Panics

Performs a checked subtraction, and will panic! on underflow in both debug and release.

Auto Trait Implementations

impl Unpin for PgMoney

impl Sync for PgMoney

impl Send for PgMoney

impl UnwindSafe for PgMoney

impl RefUnwindSafe for PgMoney

Blanket Implementations

impl<T> IntoSql for T[src]

fn into_sql<T>(self) -> AsExprOf<Self, T> where
    Self: AsExpression<T> + Sized
[src]

Convert self to an expression for Diesel's query builder. Read more

fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T> where
    &'a Self: AsExpression<T>, 
[src]

Convert &self to an expression for Diesel's query builder. Read more

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]