Skip to content

Commit 0bc4127

Browse files
committed
drafted working support for tstzrange using chrono::DateTime<Utc>
1 parent a175981 commit 0bc4127

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ documentation = "https://sfackler.github.io/rust-postgres-range/doc/v0.9.0/postg
1111
time = "0.1"
1212
postgres = "0.15"
1313
postgres-protocol = "0.3"
14+
chrono = "0.4.0"
15+
postgres-shared = { version = "0.4.0", features = ["with-chrono"] }
1416

1517
[dev-dependencies]
16-
postgres = { version = "0.15", features = ["with-time"] }
18+
postgres = { version = "0.15", features = ["with-time"] }

src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
#[macro_use(to_sql_checked)]
55
extern crate postgres;
66
extern crate postgres_protocol;
7+
extern crate postgres_shared;
78
extern crate time;
9+
extern crate chrono;
10+
use chrono::prelude::*;
11+
use chrono::DateTime;
812

913
use std::cmp::Ordering;
1014
use std::fmt;
@@ -155,6 +159,16 @@ impl Normalizable for Timespec {
155159
}
156160
}
157161

162+
impl Normalizable for DateTime<Utc> {
163+
fn normalize<S>(bound: RangeBound<S, DateTime<Utc>>) -> RangeBound<S, DateTime<Utc>>
164+
where
165+
S: BoundSided,
166+
{
167+
bound
168+
}
169+
}
170+
171+
158172
/// The possible sides of a bound.
159173
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
160174
pub enum BoundSide {

0 commit comments

Comments
 (0)