1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use std::fmt::{Debug, Display};
use crate::database::Database;
#[cfg(feature = "uuid")]
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
pub use uuid::Uuid;
#[cfg(feature = "chrono")]
#[cfg_attr(docsrs, doc(cfg(feature = "chrono")))]
pub mod chrono {
pub use chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc};
}
#[cfg(feature = "time")]
#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
pub mod time {
pub use time::{Date, OffsetDateTime, PrimitiveDateTime, Time, UtcOffset};
}
#[cfg(feature = "bigdecimal")]
#[cfg_attr(docsrs, doc(cfg(feature = "bigdecimal")))]
pub use bigdecimal::BigDecimal;
#[cfg(feature = "ipnetwork")]
#[cfg_attr(docsrs, doc(cfg(feature = "ipnetwork")))]
pub mod ipnetwork {
pub use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
}
#[cfg(feature = "json")]
#[cfg_attr(docsrs, doc(cfg(feature = "json")))]
#[derive(Debug, PartialEq)]
pub struct Json<T>(pub T);
pub trait TypeInfo: PartialEq<Self> + Debug + Display + Clone {
fn compatible(&self, other: &Self) -> bool;
}
pub trait Type<DB>
where
DB: Database,
{
fn type_info() -> DB::TypeInfo;
}
impl<T: ?Sized, DB> Type<DB> for &'_ T
where
DB: Database,
T: Type<DB>,
{
fn type_info() -> DB::TypeInfo {
<T as Type<DB>>::type_info()
}
}
impl<T, DB> Type<DB> for Option<T>
where
DB: Database,
T: Type<DB>,
{
fn type_info() -> DB::TypeInfo {
<T as Type<DB>>::type_info()
}
}