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

pub struct Cents(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 PartialOrd<PgMoney> for PgMoney[src]

impl Copy for PgMoney[src]

impl PartialEq<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 Ord for PgMoney[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.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)

Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more

impl Eq 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 Send for PgMoney

impl Sync 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, U> Into for T where
    U: From<T>, 
[src]

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.