Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita8caff1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into remove-rustc-serialize-dependency
2 parentsb1306a4 +ab23ca8 commita8caff1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

‎postgres-types/src/chrono_04.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use bytes::BytesMut;
2-
use chrono_04::{DateTime,Duration,FixedOffset,Local,NaiveDate,NaiveDateTime,NaiveTime,Utc};
2+
use chrono_04::{
3+
DateTime,Duration,FixedOffset,Local,NaiveDate,NaiveDateTime,NaiveTime,TimeZone,Utc,
4+
};
35
use postgres_protocol::types;
46
use std::error::Error;
57

@@ -40,7 +42,7 @@ impl ToSql for NaiveDateTime {
4042
impl<'a>FromSql<'a>forDateTime<Utc>{
4143
fnfrom_sql(type_:&Type,raw:&[u8]) ->Result<DateTime<Utc>,Box<dynError +Sync +Send>>{
4244
let naive =NaiveDateTime::from_sql(type_, raw)?;
43-
Ok(DateTime::from_utc(naive,Utc))
45+
Ok(Utc.from_utc_datetime(&naive))
4446
}
4547

4648
accepts!(TIMESTAMPTZ);

‎tokio-postgres/tests/test/types/chrono_04.rs‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ async fn test_with_special_naive_date_time_params() {
5353
asyncfntest_date_time_params(){
5454
fnmake_check(time:&str) ->(Option<DateTime<Utc>>,&str){
5555
(
56-
Some(
57-
Utc.datetime_from_str(time,"'%Y-%m-%d %H:%M:%S.%f'")
58-
.unwrap(),
59-
),
56+
Some(Utc.from_utc_datetime(
57+
&NaiveDateTime::parse_from_str(time,"'%Y-%m-%d %H:%M:%S.%f'").unwrap(),
58+
)),
6059
time,
6160
)
6261
}
@@ -76,10 +75,9 @@ async fn test_date_time_params() {
7675
asyncfntest_with_special_date_time_params(){
7776
fnmake_check(time:&str) ->(Timestamp<DateTime<Utc>>,&str){
7877
(
79-
Timestamp::Value(
80-
Utc.datetime_from_str(time,"'%Y-%m-%d %H:%M:%S.%f'")
81-
.unwrap(),
82-
),
78+
Timestamp::Value(Utc.from_utc_datetime(
79+
&NaiveDateTime::parse_from_str(time,"'%Y-%m-%d %H:%M:%S.%f'").unwrap(),
80+
)),
8381
time,
8482
)
8583
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp