Skip to main content

Timestamptz

Struct Timestamptz 

Source
#[repr(transparent)]
pub struct Timestamptz(i64);
Expand description

Timestamp with timezone.

Tuple Fields§

§0: i64

Implementations§

Source§

impl Timestamptz

Source

pub const MIN: Self

Source

pub fn from_secs(timestamp_secs: i64) -> Option<Self>

Creates a Timestamptz from seconds. Returns None if the given timestamp is out of range.

Source

pub fn from_millis(timestamp_millis: i64) -> Option<Self>

Creates a Timestamptz from milliseconds. Returns None if the given timestamp is out of range.

Source

pub fn from_micros(timestamp_micros: i64) -> Self

Creates a Timestamptz from microseconds.

Source

pub fn from_nanos(timestamp_nanos: i64) -> Option<Self>

Creates a Timestamptz from microseconds.

Source

pub fn timestamp_micros(&self) -> i64

Returns the number of non-leap-microseconds since January 1, 1970 UTC.

Source

pub fn timestamp_millis(&self) -> i64

Returns the number of non-leap-milliseconds since January 1, 1970 UTC.

Source

pub fn timestamp_nanos(&self) -> Option<i64>

Returns the number of non-leap-nanosseconds since January 1, 1970 UTC.

Source

pub fn timestamp(&self) -> i64

Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).

Source

pub fn timestamp_subsec_nanos(&self) -> u32

Returns the number of nanoseconds since the last second boundary.

Source

pub fn to_datetime_utc(self) -> DateTime<Utc>

Source

pub fn to_datetime_in_zone(self, tz: Tz) -> DateTime<Tz>

Source

pub fn lookup_time_zone(time_zone: &str) -> Result<Tz, String>

Source

pub fn from_protobuf(cur: &mut Cursor<&[u8]>) -> ArrayResult<Timestamptz>

Source

pub fn to_protobuf(self, output: &mut impl Write) -> ArrayResult<usize>

Trait Implementations§

Source§

impl ChronoFieldInner for Timestamptz

Source§

fn from_now() -> Self

Source§

fn from_base(base: DateTime<FixedOffset>) -> Self

Source§

fn minus(&self, duration: Duration) -> Self

Source§

fn to_json(&self) -> Value

Source§

impl Clone for Timestamptz

Source§

fn clone(&self) -> Timestamptz

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Timestamptz

Source§

impl Debug for Timestamptz

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Timestamptz

Source§

fn default() -> Timestamptz

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Timestamptz

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Timestamptz

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Timestamptz

Source§

impl<Tz: TimeZone> From<DateTime<Tz>> for Timestamptz

Source§

fn from(dt: DateTime<Tz>) -> Self

Converts to this type from the input type.
Source§

impl From<Timestamptz> for DateTime<Utc>

Source§

fn from(tz: Timestamptz) -> Self

Converts to this type from the input type.
Source§

impl From<Timestamptz> for ScalarImpl

Source§

fn from(val: Timestamptz) -> Self

Converts to this type from the input type.
Source§

impl<'scalar> From<Timestamptz> for ScalarRefImpl<'scalar>

Source§

fn from(val: Timestamptz) -> Self

Converts to this type from the input type.
Source§

impl FromIntoArrowWithUnit for Timestamptz

Source§

type ArrowType = i64

Source§

type TimestampType = TimeUnit

The timestamp type used to distinguish different time units, only utilized when the Arrow type is a timestamp.
Source§

fn from_arrow_with_unit( value: Self::ArrowType, time_unit: Self::TimestampType, ) -> Self

Source§

fn into_arrow_with_unit(self, time_unit: Self::TimestampType) -> Self::ArrowType

Source§

impl<'a> FromSql<'a> for Timestamptz

Source§

fn from_sql( ty: &Type, raw: &'a [u8], ) -> Result<Self, Box<dyn Error + Sync + Send>>

Creates a new value of this type from a buffer of data of the specified Postgres Type in its binary format. Read more
Source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be created from the specified Postgres Type.
§

fn from_sql_null(ty: &Type) -> Result<Self, Box<dyn Error + Send + Sync>>

Creates a new value of this type from a NULL SQL value. Read more
§

fn from_sql_nullable( ty: &Type, raw: Option<&'a [u8]>, ) -> Result<Self, Box<dyn Error + Send + Sync>>

A convenience function that delegates to from_sql and from_sql_null depending on the value of raw.
Source§

impl FromStr for Timestamptz

Source§

type Err = &'static str

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Timestamptz

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl HashKeyDe for Timestamptz

Source§

fn deserialize(_data_type: &DataType, buf: impl Buf) -> Self

Source§

impl HashKeySer<'_> for Timestamptz

Source§

fn serialize_into(self, buf: impl BufMut)

Serialize the scalar into the given buffer.
Source§

fn exact_size() -> Option<usize>

Returns Some if the serialized size is known for this scalar type.
Source§

fn estimated_size(self) -> usize

Returns the estimated serialized size for this scalar.
Source§

impl Ord for Timestamptz

Source§

fn cmp(&self, other: &Timestamptz) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Timestamptz

Source§

fn eq(&self, other: &Timestamptz) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Timestamptz

Source§

fn partial_cmp(&self, other: &Timestamptz) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrimitiveArrayItemType for Timestamptz

Source§

const DATA_TYPE: DataType = DataType::Timestamptz

The data type.
Source§

fn erase_array_type(arr: PrimitiveArray<Self>) -> ArrayImpl

A helper to convert a primitive array to ArrayImpl.
Source§

fn try_into_array(arr: ArrayImpl) -> Option<PrimitiveArray<Self>>

A helper to convert ArrayImpl to self.
Source§

fn try_into_array_ref(arr: &ArrayImpl) -> Option<&PrimitiveArray<Self>>

A helper to convert ArrayImpl to self.
Source§

fn array_type() -> ArrayType

Returns array type of the primitive array
Source§

fn to_protobuf<T: Write>(self, output: &mut T) -> ArrayResult<usize>

Source§

fn from_protobuf(cur: &mut Cursor<&[u8]>) -> ArrayResult<Self>

Source§

impl RandValue for Timestamptz

Source§

fn rand_value<R: Rng>(rand: &mut R) -> Self

Source§

impl Scalar for Timestamptz

Implement Scalar for Timestamptz.

Source§

type ScalarRefType<'a> = Timestamptz

Type for reference of Scalar
Source§

fn as_scalar_ref(&self) -> Timestamptz

Get a reference to current scalar.
Source§

fn to_scalar_value(self) -> ScalarImpl

Source§

impl ScalarRef<'_> for Timestamptz

Implement ScalarRef for Timestamptz.

Source§

type ScalarType = Timestamptz

ScalarType is the owned type of current ScalarRef.
Source§

fn to_owned_scalar(&self) -> Timestamptz

Convert ScalarRef to an owned scalar.
Source§

fn hash_scalar<H: Hasher>(&self, state: &mut H)

A wrapped hash function to get the hash value for this scaler.
Source§

impl Serialize for Timestamptz

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Timestamptz

Source§

impl ToBinary for Timestamptz

Source§

impl ToSql for Timestamptz

Source§

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be converted to the specified Postgres Type.
Source§

fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>

An adaptor method used internally by Rust-Postgres. Read more
Source§

fn to_sql( &self, _: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
where Self: Sized,

Converts the value of self into the binary format of the specified Postgres Type, appending it to out. Read more
§

fn encode_format(&self, _ty: &Type) -> Format

Specify the encode format
Source§

impl ToText for Timestamptz

Source§

fn write<W: Write>(&self, f: &mut W) -> Result

Write the text to the writer regardless of its data type Read more
Source§

fn write_with_type<W: Write>(&self, ty: &DataType, f: &mut W) -> Result

Write the text to the writer according to its data type
Source§

fn to_text_with_type(&self, ty: &DataType) -> String

Convert to text according to its data type
Source§

fn to_text(&self) -> String

to_text is a special version of to_text_with_type, it convert the scalar to default type text. E.g. for Int64, it will convert to text as a Int64 type. We should prefer to use to_text_with_type because it’s more clear and readable. Read more
Source§

fn text_display(&self) -> impl Display + '_

Returns an displayable wrapper implemented with ToText::write.
Source§

impl TryFrom<ScalarImpl> for Timestamptz

Source§

type Error = ArrayError

The type returned in the event of a conversion error.
Source§

fn try_from(val: ScalarImpl) -> ArrayResult<Self>

Performs the conversion.
Source§

impl<'scalar> TryFrom<ScalarRefImpl<'scalar>> for Timestamptz

Source§

type Error = ArrayError

The type returned in the event of a conversion error.
Source§

fn try_from(val: ScalarRefImpl<'scalar>) -> ArrayResult<Self>

Performs the conversion.
Source§

impl WithDataType for Timestamptz

Source§

fn default_data_type() -> DataType

Returns the most obvious DataType for the rust type.
Source§

impl<'a> WithDataType for &'a Timestamptz

Source§

fn default_data_type() -> DataType

Returns the most obvious DataType for the rust type.
Source§

impl<'a> WithDataType for &'a mut Timestamptz

Source§

fn default_data_type() -> DataType

Returns the most obvious DataType for the rust type.
Source§

impl WithDataType for Box<Timestamptz>

Source§

fn default_data_type() -> DataType

Returns the most obvious DataType for the rust type.
Source§

impl ZeroHeapSize for Timestamptz

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn type_name(&self) -> &'static str

Gets the type name of self
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> BorrowToSql for T
where T: ToSql,

§

fn borrow_to_sql(&self) -> &dyn ToSql

Returns a reference to self as a ToSql trait object.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Code for T

§

fn encode(&self, writer: &mut impl Write) -> Result<(), Error>

Encode the object into a writer. Read more
§

fn decode(reader: &mut impl Read) -> Result<T, Error>

Decode the object from a reader. Read more
§

fn estimated_size(&self) -> usize

Estimated serialized size of the object. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Downcast for T
where T: AsAny + ?Sized,

§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

impl<T> DynClone for T
where T: Clone,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> EstimateSize for T
where T: ZeroHeapSize,

Source§

fn estimated_heap_size(&self) -> usize

The estimated heap size of the current struct in bytes.
Source§

fn estimated_size(&self) -> usize
where Self: Sized,

The estimated total size of the current struct in bytes, including the estimated_heap_size and the size of Self.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FromSqlOwned for T
where T: for<'a> FromSql<'a>,

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoResult<T> for T

§

type Err = Infallible

§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

§

impl<T> Key for T
where T: Send + Sync + 'static + Hash + Eq,

§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
Source§

impl<T> LruKey for T
where T: Eq + Send + Hash,

Source§

impl<T> LruValue for T
where T: Send + Sync,

§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<M> MetricVecRelabelExt for M

Source§

fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

Source§

fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>

Source§

fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>

Equivalent to RelabeledMetricVec::with_metric_level_relabel_n with metric_level set to MetricLevel::Debug and relabel_num set to 1.
Source§

impl<N> NodeTrait for N
where N: Copy + Ord + Hash,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SameOrElseExt for T
where T: Eq,

Source§

fn same_or_else(self, other: T, f: impl FnOnce() -> T) -> T

Check if self and other are equal, if so, return self, otherwise return the result of f().
Source§

impl<T> ScalarPartialOrd for T

Source§

fn scalar_cmp(&self, other: T) -> Option<Ordering>

§

impl<T> Scope for T

§

fn with<F, R>(self, f: F) -> R
where Self: Sized, F: FnOnce(Self) -> R,

Scoped with ownership.
§

fn with_ref<F, R>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Scoped with reference.
§

fn with_mut<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Scoped with mutable reference.
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

§

impl<T> StorageKey for T
where T: Key + Code,

§

impl<T> StorageValue for T
where T: Value + Code,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToOwnedDatum for T
where T: Into<ScalarImpl>,

Source§

fn to_owned_datum(self) -> Option<ScalarImpl>

Convert the datum to an owned Datum.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> ToStringFallible for T
where T: Display,

§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Value for T
where T: Send + Sync + 'static,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more