pub struct Timestamp { /* private fields */ }Expand description
A timestamp value (microseconds since 2000-01-01 00:00:00).
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_microseconds(microseconds: i64) -> Timestamp
pub const fn from_microseconds(microseconds: i64) -> Timestamp
Creates a Timestamp from microseconds since 2000-01-01.
Sourcepub fn new(date: Date, time: Time) -> Timestamp
pub fn new(date: Date, time: Time) -> Timestamp
Creates a Timestamp from date and time components.
Sourcepub const fn microseconds(&self) -> i64
pub const fn microseconds(&self) -> i64
Returns microseconds since 2000-01-01 (internal representation).
Sourcepub fn to_date_time(&self) -> (Date, Time)
pub fn to_date_time(&self) -> (Date, Time)
Returns the date and time components.
Sourcepub const fn encode(&self) -> u64
pub const fn encode(&self) -> u64
Returns the raw encoded value for HyperBinary (Julian-based microseconds).
Sourcepub const fn decode(encoded: u64) -> Timestamp
pub const fn decode(encoded: u64) -> Timestamp
Creates a Timestamp from a raw encoded value (Julian-based microseconds).
Sourcepub const fn to_microseconds(&self) -> i64
pub const fn to_microseconds(&self) -> i64
Returns microseconds since Julian Day 0 for binary insertion.
Hyper stores timestamps as Julian-based microseconds.
Trait Implementations§
Source§impl From<NaiveDateTime> for Timestamp
impl From<NaiveDateTime> for Timestamp
Source§fn from(dt: NaiveDateTime) -> Timestamp
fn from(dt: NaiveDateTime) -> Timestamp
Converts to this type from the input type.
Source§impl FromBinaryValue for Timestamp
impl FromBinaryValue for Timestamp
Source§impl FromHyperBinary for Timestamp
impl FromHyperBinary for Timestamp
Source§impl ToHyperBinary for Timestamp
impl ToHyperBinary for Timestamp
Source§fn to_hyper_binary(
&self,
buf: &mut BytesMut,
) -> Result<(), Box<dyn Error + Sync + Send>>
fn to_hyper_binary( &self, buf: &mut BytesMut, ) -> Result<(), Box<dyn Error + Sync + Send>>
Serializes the value to HyperBinary format for a nullable column. Read more
Source§fn to_hyper_binary_not_null(
&self,
buf: &mut BytesMut,
) -> Result<(), Box<dyn Error + Sync + Send>>
fn to_hyper_binary_not_null( &self, buf: &mut BytesMut, ) -> Result<(), Box<dyn Error + Sync + Send>>
Serializes the value to HyperBinary format for a NOT NULL column. Read more
Source§fn hyper_binary_size(&self) -> usize
fn hyper_binary_size(&self) -> usize
Returns the size in bytes this value will occupy when serialized (nullable).
Source§fn hyper_binary_size_not_null(&self) -> usize
fn hyper_binary_size_not_null(&self) -> usize
Returns the size in bytes this value will occupy when serialized (not nullable).
Source§impl ToSqlParam for Timestamp
impl ToSqlParam for Timestamp
impl Copy for Timestamp
impl Eq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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§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> 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