Struct mz_repr::adt::timestamp::CheckedTimestamp
source · pub struct CheckedTimestamp<T> {
t: T,
}
Fields§
§t: T
Implementations§
source§impl<T: TimestampLike> CheckedTimestamp<T>
impl<T: TimestampLike> CheckedTimestamp<T>
pub fn from_timestamplike(t: T) -> Result<Self, TimestampError>
pub fn checked_add_signed(self, rhs: Duration) -> Option<T>
pub fn checked_sub_signed(self, rhs: Duration) -> Option<T>
sourcepub fn diff_as(
&self,
other: &Self,
unit: DateTimePart,
) -> Result<i64, TimestampError>
pub fn diff_as( &self, other: &Self, unit: DateTimePart, ) -> Result<i64, TimestampError>
Returns the difference between self
and the provided CheckedTimestamp
as a number of
“unit“s.
Note: used for DATEDIFF(...)
, which isn’t a Postgres function, but is in a number of
other databases.
sourcepub fn age(&self, other: &Self) -> Result<Interval, TimestampError>
pub fn age(&self, other: &Self) -> Result<Interval, TimestampError>
Implementation was roughly ported from Postgres’s timestamp.c
.
https://github.com/postgres/postgres/blob/REL_15_3/src/backend/utils/adt/timestamp.c#L3631
sourcepub fn round_to_precision(
&self,
precision: Option<TimestampPrecision>,
) -> Result<CheckedTimestamp<T>, TimestampError>
pub fn round_to_precision( &self, precision: Option<TimestampPrecision>, ) -> Result<CheckedTimestamp<T>, TimestampError>
Rounds the timestamp to the specified number of digits of precision.
source§impl CheckedTimestamp<NaiveDateTime>
impl CheckedTimestamp<NaiveDateTime>
pub fn to_naive(&self) -> NaiveDateTime
source§impl CheckedTimestamp<DateTime<Utc>>
impl CheckedTimestamp<DateTime<Utc>>
pub fn to_naive(&self) -> NaiveDateTime
Trait Implementations§
source§impl Arbitrary for CheckedTimestamp<DateTime<Utc>>
impl Arbitrary for CheckedTimestamp<DateTime<Utc>>
§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = BoxedStrategy<CheckedTimestamp<DateTime<Utc>>>
type Strategy = BoxedStrategy<CheckedTimestamp<DateTime<Utc>>>
The type of
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
source§impl Arbitrary for CheckedTimestamp<NaiveDateTime>
impl Arbitrary for CheckedTimestamp<NaiveDateTime>
§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = BoxedStrategy<CheckedTimestamp<NaiveDateTime>>
type Strategy = BoxedStrategy<CheckedTimestamp<NaiveDateTime>>
The type of
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_: Self::Parameters) -> Self::Strategy
source§impl AsColumnType for CheckedTimestamp<DateTime<Utc>>
impl AsColumnType for CheckedTimestamp<DateTime<Utc>>
source§fn as_column_type() -> ColumnType
fn as_column_type() -> ColumnType
The SQL column type of this Rust type
source§impl AsColumnType for CheckedTimestamp<NaiveDateTime>
impl AsColumnType for CheckedTimestamp<NaiveDateTime>
source§fn as_column_type() -> ColumnType
fn as_column_type() -> ColumnType
The SQL column type of this Rust type
source§impl<T: Clone> Clone for CheckedTimestamp<T>
impl<T: Clone> Clone for CheckedTimestamp<T>
source§fn clone(&self) -> CheckedTimestamp<T>
fn clone(&self) -> CheckedTimestamp<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a, E> DatumType<'a, E> for CheckedTimestamp<DateTime<Utc>>
impl<'a, E> DatumType<'a, E> for CheckedTimestamp<DateTime<Utc>>
source§impl<'a, E> DatumType<'a, E> for CheckedTimestamp<NaiveDateTime>
impl<'a, E> DatumType<'a, E> for CheckedTimestamp<NaiveDateTime>
source§impl<T: Debug> Debug for CheckedTimestamp<T>
impl<T: Debug> Debug for CheckedTimestamp<T>
source§impl<T: TimestampLike> Deref for CheckedTimestamp<T>
impl<T: TimestampLike> Deref for CheckedTimestamp<T>
source§impl Display for CheckedTimestamp<NaiveDateTime>
impl Display for CheckedTimestamp<NaiveDateTime>
source§impl<'a> From<CheckedTimestamp<NaiveDateTime>> for Datum<'a>
impl<'a> From<CheckedTimestamp<NaiveDateTime>> for Datum<'a>
source§fn from(dt: CheckedTimestamp<NaiveDateTime>) -> Datum<'a>
fn from(dt: CheckedTimestamp<NaiveDateTime>) -> Datum<'a>
Converts to this type from the input type.
source§impl From<CheckedTimestamp<NaiveDateTime>> for NaiveDateTime
impl From<CheckedTimestamp<NaiveDateTime>> for NaiveDateTime
source§fn from(val: CheckedTimestamp<NaiveDateTime>) -> Self
fn from(val: CheckedTimestamp<NaiveDateTime>) -> Self
Converts to this type from the input type.
source§impl<T: Hash> Hash for CheckedTimestamp<T>
impl<T: Hash> Hash for CheckedTimestamp<T>
source§impl<T: Ord> Ord for CheckedTimestamp<T>
impl<T: Ord> Ord for CheckedTimestamp<T>
source§fn cmp(&self, other: &CheckedTimestamp<T>) -> Ordering
fn cmp(&self, other: &CheckedTimestamp<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq> PartialEq for CheckedTimestamp<T>
impl<T: PartialEq> PartialEq for CheckedTimestamp<T>
source§impl<T: PartialOrd> PartialOrd for CheckedTimestamp<T>
impl<T: PartialOrd> PartialOrd for CheckedTimestamp<T>
source§impl<'a> RangeOps<'a> for CheckedTimestamp<NaiveDateTime>
impl<'a> RangeOps<'a> for CheckedTimestamp<NaiveDateTime>
source§impl RustType<ProtoNaiveDateTime> for CheckedTimestamp<DateTime<Utc>>
impl RustType<ProtoNaiveDateTime> for CheckedTimestamp<DateTime<Utc>>
source§fn into_proto(&self) -> ProtoNaiveDateTime
fn into_proto(&self) -> ProtoNaiveDateTime
Convert a
Self
into a Proto
value.source§fn from_proto(proto: ProtoNaiveDateTime) -> Result<Self, TryFromProtoError>
fn from_proto(proto: ProtoNaiveDateTime) -> Result<Self, TryFromProtoError>
source§fn into_proto_owned(self) -> Proto
fn into_proto_owned(self) -> Proto
A zero clone version of
Self::into_proto
that types can
optionally implement, otherwise, the default implementation
delegates to Self::into_proto
.source§impl RustType<ProtoNaiveDateTime> for CheckedTimestamp<NaiveDateTime>
impl RustType<ProtoNaiveDateTime> for CheckedTimestamp<NaiveDateTime>
source§fn into_proto(&self) -> ProtoNaiveDateTime
fn into_proto(&self) -> ProtoNaiveDateTime
Convert a
Self
into a Proto
value.source§fn from_proto(proto: ProtoNaiveDateTime) -> Result<Self, TryFromProtoError>
fn from_proto(proto: ProtoNaiveDateTime) -> Result<Self, TryFromProtoError>
source§fn into_proto_owned(self) -> Proto
fn into_proto_owned(self) -> Proto
A zero clone version of
Self::into_proto
that types can
optionally implement, otherwise, the default implementation
delegates to Self::into_proto
.source§impl<T: Serialize> Serialize for CheckedTimestamp<T>
impl<T: Serialize> Serialize for CheckedTimestamp<T>
source§impl TryFrom<Datum<'_>> for CheckedTimestamp<NaiveDateTime>
impl TryFrom<Datum<'_>> for CheckedTimestamp<NaiveDateTime>
source§impl TryFrom<NaiveDateTime> for CheckedTimestamp<NaiveDateTime>
impl TryFrom<NaiveDateTime> for CheckedTimestamp<NaiveDateTime>
§type Error = TimestampError
type Error = TimestampError
The type returned in the event of a conversion error.
impl<T: Copy> Copy for CheckedTimestamp<T>
impl<T: Eq> Eq for CheckedTimestamp<T>
impl<T> StructuralPartialEq for CheckedTimestamp<T>
Auto Trait Implementations§
impl<T> Freeze for CheckedTimestamp<T>where
T: Freeze,
impl<T> RefUnwindSafe for CheckedTimestamp<T>where
T: RefUnwindSafe,
impl<T> Send for CheckedTimestamp<T>where
T: Send,
impl<T> Sync for CheckedTimestamp<T>where
T: Sync,
impl<T> Unpin for CheckedTimestamp<T>where
T: Unpin,
impl<T> UnwindSafe for CheckedTimestamp<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> PreferredContainer for T
impl<T> PreferredContainer for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
The method of
std::ops::AddAssign
, for types that do not implement AddAssign
.