[][src]Struct pg_interval::Interval

pub struct Interval {
    pub months: i32,
    pub days: i32,
    pub microseconds: i64,
}

Fields

months: i32days: i32microseconds: i64

Methods

impl Interval[src]

pub fn from_iso<'a>(iso_str: &'a str) -> Result<Interval, ParseError>[src]

impl Interval[src]

pub fn from_postgres<'a>(iso_str: &'a str) -> Result<Interval, ParseError>[src]

impl Interval[src]

pub fn new(months: i32, days: i32, microseconds: i64) -> Interval[src]

Create a new instance of interval from the months, days, and microseconds.

pub fn to_iso_8601(&self) -> String[src]

Output the interval as iso 8601 compliant string.

pub fn to_postgres(&self) -> String[src]

Output the interval as a postgres interval string.

pub fn to_sql(&self) -> String[src]

Output the interval as a sql compliant interval string.

impl Interval[src]

pub fn checked_add(self, other_interval: Interval) -> Option<Interval>[src]

Checked interval addition. Computes Interval + Interval and None if there was an overflow.

pub fn add_day_time(
    self,
    days: i32,
    hours: i64,
    minutes: i64,
    seconds: f64
) -> Interval
[src]

Shortcut method to add day time part to the interval. Any units smaller than a microsecond will be truncated.

pub fn checked_add_day_time(
    self,
    days: i32,
    hours: i64,
    minutes: i64,
    seconds: f64
) -> Option<Interval>
[src]

Checked day time interval addition. Computes the interval and will return None if a overflow has occured. Any units smaller than a microsecond will be truncated.

pub fn add_year_month(self, year: i32, months: i32) -> Interval[src]

Adds a year month interval.

pub fn checked_add_year_month(self, year: i32, months: i32) -> Option<Interval>[src]

Checked year month addition. Computes the interval and will return None if a overflow has occured.

impl Interval[src]

pub fn checked_sub(self, other_interval: Interval) -> Option<Interval>[src]

Checked interval subtraction. Computes Interval - Interval and None if there was an underflow.

pub fn sub_day_time(
    self,
    days: i32,
    hours: i64,
    minutes: i64,
    seconds: f64
) -> Interval
[src]

Shortcut method to subtract day time part to the interval. Any units smaller than a microsecond will be truncated.

pub fn checked_sub_day_time(
    self,
    days: i32,
    hours: i64,
    minutes: i64,
    seconds: f64
) -> Option<Interval>
[src]

Checked day time subtraction. Computes the interval and will return None if a overflow/underflow has occured. Any units smaller than a microsecond will be truncated.

pub fn sub_year_month(self, year: i32, months: i32) -> Interval[src]

Subtracts a year month interval.

pub fn checked_sub_year_month(self, year: i32, months: i32) -> Option<Interval>[src]

Checked year month subtraction. Computes the interval and will return None if a overflow has occured.

Trait Implementations

impl Clone for Interval[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Interval> for Interval[src]

impl Eq for Interval[src]

impl Copy for Interval[src]

impl Add<Interval> for Interval[src]

type Output = Interval

The resulting type after applying the + operator.

impl Sub<Interval> for Interval[src]

type Output = Interval

The resulting type after applying the - operator.

impl Debug for Interval[src]

impl ToSql for Interval[src]

impl FromSql for Interval[src]

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

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

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

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

Auto Trait Implementations

impl Send for Interval

impl Sync for Interval

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self