[go: up one dir, main page]

diesel 1.4.8

A safe, extensible ORM and Query Builder for PostgreSQL, SQLite, and MySQL
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#![cfg(feature = "bigdecimal")]

extern crate bigdecimal;

use self::bigdecimal::BigDecimal;

use deserialize::{self, FromSql};
use sql_types::{Double, Numeric};
use sqlite::connection::SqliteValue;
use sqlite::Sqlite;

impl FromSql<Numeric, Sqlite> for BigDecimal {
    fn from_sql(bytes: Option<&SqliteValue>) -> deserialize::Result<Self> {
        let data = <f64 as FromSql<Double, Sqlite>>::from_sql(bytes)?;
        Ok(data.into())
    }
}