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
use crate::database::Database;
use bitflags::_core::fmt::Debug;
use crate::Result;
use crate::types::chrono::NaiveDateTime;
use chrono::Local;
pub trait HasRawValue<'c> {
type Database: Database;
type RawValue: RawValue<'c, Database = Self::Database>+Debug;
}
pub trait RawValue<'c> {
type Database: Database;
fn type_info(&self) -> Option<<Self::Database as Database>::TypeInfo>;
fn try_to_json(&self) -> Result<serde_json::Value>;
}
pub trait DateTimeNow{
fn now()->NaiveDateTime;
}
impl DateTimeNow for NaiveDateTime{
fn now() -> NaiveDateTime {
let dt = Local::now();
dt.naive_local()
}
}