Skip to content

Commit 36636f5

Browse files
Make datetime types import each other via use super (pgcentralfoundation#2198)
A step to creating `pgrx::datetime` without breaking move-tracking.
1 parent 4b980d1 commit 36636f5

9 files changed

Lines changed: 24 additions & 26 deletions

File tree

pgrx/src/datum/date.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use pgrx_sql_entity_graph::metadata::{
1515
};
1616

1717
use super::datetime_support::{DateTimeParts, HasExtractableParts};
18-
use crate::datum::{
19-
DateTimeConversionError, DateTimeTypeVisitor, FromDatum, IntoDatum, Timestamp,
20-
TimestampWithTimeZone, ToIsoString,
18+
use super::{
19+
DateTimeConversionError, DateTimeTypeVisitor, Timestamp, TimestampWithTimeZone, ToIsoString,
2120
};
21+
use crate::datum::{FromDatum, IntoDatum};
2222
use crate::{direct_function_call, pg_sys};
2323

2424
const JULIAN_DAY_ZERO: i32 = pg_sys::DATETIME_MIN_JULIAN as i32 - POSTGRES_EPOCH_JDATE;

pgrx/src/datum/datetime_support/ctor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
1010
//! Exposes constructor methods for creating [`TimestampWithTimeZone`]s based on the various
1111
//! ways Postgres likes to interpret the "current time".
12-
use crate::datum::{Date, IntoDatum, Timestamp, TimestampWithTimeZone};
12+
use super::{Date, Timestamp, TimestampWithTimeZone};
13+
use crate::datum::IntoDatum;
1314
use crate::{direct_function_call, pg_sys};
1415

1516
/// Current date and time (start of current transaction)

pgrx/src/datum/datetime_support/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
//LICENSE All rights reserved.
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10-
use crate::datum::{
11-
AnyNumeric, Date, Interval, IntoDatum, Time, TimeWithTimeZone, Timestamp, TimestampWithTimeZone,
12-
};
10+
use super::{Date, Interval, Time, TimeWithTimeZone, Timestamp, TimestampWithTimeZone};
11+
use crate::datum::{AnyNumeric, IntoDatum};
1312
use crate::{direct_function_call, pg_sys};
1413
use core::fmt::{Display, Formatter};
1514
use core::str::FromStr;

pgrx/src/datum/datetime_support/ops.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
//LICENSE All rights reserved.
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10-
use crate::datum::{
11-
Date, Interval, IntoDatum, Time, TimeWithTimeZone, Timestamp, TimestampWithTimeZone,
12-
};
10+
use super::{Date, Interval, Time, TimeWithTimeZone, Timestamp, TimestampWithTimeZone};
11+
use crate::datum::IntoDatum;
1312
use crate::{direct_function_call, pg_sys};
1413
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
1514

pgrx/src/datum/interval.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
//LICENSE All rights reserved.
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10-
use crate::datum::datetime_support::{IntervalConversionError, USECS_PER_DAY, USECS_PER_SEC};
11-
use crate::datum::{DateTimeParts, DateTimeTypeVisitor, FromDatum, IntoDatum, Time, ToIsoString};
10+
use super::datetime_support::{IntervalConversionError, USECS_PER_DAY, USECS_PER_SEC};
11+
use super::{DateTimeParts, DateTimeTypeVisitor, Time, ToIsoString};
12+
use crate::datum::{FromDatum, IntoDatum};
1213
use crate::{direct_function_call, pg_sys};
1314
use pgrx_sql_entity_graph::metadata::{
1415
ArgumentError, Returns, ReturnsError, SqlMapping, SqlTranslatable,

pgrx/src/datum/time.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
1010
use super::datetime_support::*;
11-
use super::{
12-
DateTimeTypeVisitor, FromDatum, Interval, IntoDatum, TimeWithTimeZone, Timestamp,
13-
TimestampWithTimeZone,
14-
};
11+
use super::{DateTimeTypeVisitor, Interval, TimeWithTimeZone, Timestamp, TimestampWithTimeZone};
12+
use crate::datum::{FromDatum, IntoDatum};
1513
use crate::{direct_function_call, pg_sys};
1614
use pgrx_pg_sys::PgTryBuilder;
1715
use pgrx_pg_sys::errcodes::PgSqlErrorCode;

pgrx/src/datum/time_stamp.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
//LICENSE All rights reserved.
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10-
use crate::datum::{
11-
Date, DateTimeConversionError, DateTimeParts, DateTimeTypeVisitor, FromDatum,
12-
HasExtractableParts, Interval, IntoDatum, Time, TimestampWithTimeZone, ToIsoString,
10+
use super::{
11+
Date, DateTimeConversionError, DateTimeParts, DateTimeTypeVisitor, HasExtractableParts,
12+
Interval, Time, TimestampWithTimeZone, ToIsoString,
1313
};
14+
use crate::datum::{FromDatum, IntoDatum};
1415
use crate::{direct_function_call, pg_sys};
1516
use pgrx_pg_sys::PgTryBuilder;
1617
use pgrx_pg_sys::errcodes::PgSqlErrorCode;

pgrx/src/datum/time_stamp_with_timezone.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
1010
use super::{
11-
Date, DateTimeConversionError, DateTimeParts, DateTimeTypeVisitor, FromDatum,
12-
HasExtractableParts, Interval, IntoDatum, Timestamp, ToIsoString,
11+
Date, DateTimeConversionError, DateTimeParts, DateTimeTypeVisitor, HasExtractableParts,
12+
Interval, Timestamp, ToIsoString,
1313
};
14+
use crate::datum::{FromDatum, IntoDatum};
1415
use crate::{direct_function_call, pg_sys};
1516
use pgrx_pg_sys::PgTryBuilder;
1617
use pgrx_pg_sys::errcodes::PgSqlErrorCode;

pgrx/src/datum/time_with_timezone.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
//LICENSE All rights reserved.
88
//LICENSE
99
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10-
use super::{
11-
DateTimeConversionError, FromDatum, Interval, IntoDatum, Time, TimestampWithTimeZone,
12-
ToIsoString,
13-
};
14-
use crate::datum::datetime_support::{DateTimeParts, HasExtractableParts, USECS_PER_DAY};
10+
use super::datetime_support::{DateTimeParts, HasExtractableParts, USECS_PER_DAY};
11+
use super::{DateTimeConversionError, Interval, Time, TimestampWithTimeZone, ToIsoString};
12+
use crate::datum::{FromDatum, IntoDatum};
1513
use crate::{PgMemoryContexts, direct_function_call, direct_function_call_as_datum, pg_sys};
1614
use pgrx_pg_sys::PgTryBuilder;
1715
use pgrx_pg_sys::errcodes::PgSqlErrorCode;

0 commit comments

Comments
 (0)