pub struct IntervalFormat {
pub years: i32,
pub months: i32,
pub days: i32,
pub hours: i64,
pub minutes: i64,
pub seconds: i64,
pub microseconds: i64,
}
Expand description
https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-OUTPUT support postgres format, iso8601 format and sql standard format
Fields§
§years: i32
§months: i32
§days: i32
§hours: i64
§minutes: i64
§seconds: i64
§microseconds: i64
Implementations§
source§impl IntervalFormat
impl IntervalFormat
sourcepub fn has_year_month(&self) -> bool
pub fn has_year_month(&self) -> bool
Determine if year or month exist
sourcepub fn has_time_part_positive(&self) -> bool
pub fn has_time_part_positive(&self) -> bool
Determine time part(includes hours, minutes, seconds, microseconds) is positive
pub fn has_time_part(&self) -> bool
sourcepub fn to_iso8601_string(&self) -> String
pub fn to_iso8601_string(&self) -> String
Convert IntervalFormat to iso8601 format string ISO pattern - PnYnMnDTnHnMnS for example: P1Y2M3DT4H5M6.789S
sourcepub fn to_sql_standard_string(self) -> String
pub fn to_sql_standard_string(self) -> String
Convert IntervalFormat to sql standard format string
SQL standard pattern - [years - months] [days] [hours:minutes:seconds[.fractional seconds]]
for example: 1-2 3:4:5.678
sourcepub fn to_postgres_string(&self) -> String
pub fn to_postgres_string(&self) -> String
Convert IntervalFormat to postgres format string
postgres pattern - [years - months] [days] [hours[:minutes[:seconds[.fractional seconds]]]]
for example: -1 year -2 mons +3 days -04:05:06
sourcefn get_postgres_time_part(&self) -> String
fn get_postgres_time_part(&self) -> String
get postgres time part(include hours, minutes, seconds, microseconds)
sourcefn padding_i64(val: i64) -> String
fn padding_i64(val: i64) -> String
padding i64 to string with 2 digits
Trait Implementations§
source§impl Clone for IntervalFormat
impl Clone for IntervalFormat
source§fn clone(&self) -> IntervalFormat
fn clone(&self) -> IntervalFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for IntervalFormat
impl Debug for IntervalFormat
source§impl Default for IntervalFormat
impl Default for IntervalFormat
source§fn default() -> IntervalFormat
fn default() -> IntervalFormat
source§impl<'de> Deserialize<'de> for IntervalFormat
impl<'de> Deserialize<'de> for IntervalFormat
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<IntervalDayTime> for IntervalFormat
impl From<IntervalDayTime> for IntervalFormat
source§fn from(interval: IntervalDayTime) -> Self
fn from(interval: IntervalDayTime) -> Self
source§impl From<IntervalMonthDayNano> for IntervalFormat
impl From<IntervalMonthDayNano> for IntervalFormat
source§fn from(interval: IntervalMonthDayNano) -> Self
fn from(interval: IntervalMonthDayNano) -> Self
source§impl From<IntervalYearMonth> for IntervalFormat
impl From<IntervalYearMonth> for IntervalFormat
source§fn from(interval: IntervalYearMonth) -> Self
fn from(interval: IntervalYearMonth) -> Self
source§impl Serialize for IntervalFormat
impl Serialize for IntervalFormat
impl Copy for IntervalFormat
Auto Trait Implementations§
impl Freeze for IntervalFormat
impl RefUnwindSafe for IntervalFormat
impl Send for IntervalFormat
impl Sync for IntervalFormat
impl Unpin for IntervalFormat
impl UnwindSafe for IntervalFormat
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
T
in a tonic::Request