Struct diesel::pg::types::sql_types::Money [] [src]

pub struct Money;

The PostgreSQL Money type.

ToSql impls

FromSql impls

Examples


use diesel::data_types::Cents;

#[derive(Queryable)]
struct Item {
    id: i32,
    name: String,
    price: Cents,
}

#[derive(Insertable)]
#[table_name="items"]
struct NewItem {
    name: String,
    price: Cents,
}

table! {
    items {
        id -> Integer,
        name -> VarChar,
        price -> Money,
    }
}

let new_item = NewItem {
    name: "Shiny Thing".into(),
    price: Cents(123456),
};
let inserted_item = insert(&new_item).into(items)
    .get_result::<Item>(&connection).unwrap();
assert_eq!(Cents(123456), inserted_item.price);

Trait Implementations

impl QueryId for Money
[src]

impl NotNull for Money
[src]

impl SingleValue for Money
[src]

impl Debug for Money
[src]

Formats the value using the given formatter.

impl Clone for Money
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Money
[src]

impl Default for Money
[src]

Returns the "default value" for a type. Read more