Struct diesel::pg::data_types::PgInterval
source · [−]Expand description
Intervals in Postgres are separated into 3 parts. A 64 bit integer representing time in microseconds, a 32 bit integer representing number of days, and a 32 bit integer representing number of months. This struct is a dumb wrapper type, meant only to indicate the meaning of these parts.
Fields
microseconds: i64
The number of whole microseconds
days: i32
The number of whole days
months: i32
The number of whole months
Implementations
sourceimpl PgInterval
impl PgInterval
sourcepub fn new(microseconds: i64, days: i32, months: i32) -> Self
pub fn new(microseconds: i64, days: i32, months: i32) -> Self
Constructs a new PgInterval
No conversion occurs on the arguments. It is valid to provide a number of microseconds greater than the longest possible day, or a number of days greater than the longest possible month, as it is impossible to say how many months are in “40 days” without knowing a precise date.
sourcepub fn from_microseconds(microseconds: i64) -> Self
pub fn from_microseconds(microseconds: i64) -> Self
Equivalent to new(microseconds, 0, 0)
sourcepub fn from_months(months: i32) -> Self
pub fn from_months(months: i32) -> Self
Equivalent to new(0, 0, months)
Trait Implementations
sourceimpl Add<PgInterval> for PgInterval
impl Add<PgInterval> for PgInterval
type Output = PgInterval
type Output = PgInterval
The resulting type after applying the +
operator.
sourcefn add(self, other: PgInterval) -> Self::Output
fn add(self, other: PgInterval) -> Self::Output
Performs the +
operation. Read more
sourceimpl<'expr> AsExpression<Interval> for &'expr PgInterval
impl<'expr> AsExpression<Interval> for &'expr PgInterval
type Expression = Bound<Interval, Self>
type Expression = Bound<Interval, Self>
The expression being returned
sourcefn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
sourceimpl AsExpression<Interval> for PgInterval
impl AsExpression<Interval> for PgInterval
type Expression = Bound<Interval, Self>
type Expression = Bound<Interval, Self>
The expression being returned
sourcefn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
sourceimpl<'expr> AsExpression<Nullable<Interval>> for &'expr PgInterval
impl<'expr> AsExpression<Nullable<Interval>> for &'expr PgInterval
type Expression = Bound<Nullable<Interval>, Self>
type Expression = Bound<Nullable<Interval>, Self>
The expression being returned
sourcefn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
sourceimpl AsExpression<Nullable<Interval>> for PgInterval
impl AsExpression<Nullable<Interval>> for PgInterval
type Expression = Bound<Nullable<Interval>, Self>
type Expression = Bound<Nullable<Interval>, Self>
The expression being returned
sourcefn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
sourceimpl Clone for PgInterval
impl Clone for PgInterval
sourcefn clone(&self) -> PgInterval
fn clone(&self) -> PgInterval
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PgInterval
impl Debug for PgInterval
sourceimpl FromSql<Interval, Pg> for PgInterval
impl FromSql<Interval, Pg> for PgInterval
sourceimpl<__ST, __DB> FromSqlRow<__ST, __DB> for PgInterval where
__DB: Backend,
Self: FromSql<__ST, __DB>,
impl<__ST, __DB> FromSqlRow<__ST, __DB> for PgInterval where
__DB: Backend,
Self: FromSql<__ST, __DB>,
sourcefn build_from_row<R: Row<__DB>>(row: &mut R) -> Result<Self>
fn build_from_row<R: Row<__DB>>(row: &mut R) -> Result<Self>
See the trait documentation.
sourceconst FIELDS_NEEDED: usize
const FIELDS_NEEDED: usize
The number of fields that this type will consume. Must be equal to
the number of times you would call row.take()
in build_from_row
Read more
sourceimpl PartialEq<PgInterval> for PgInterval
impl PartialEq<PgInterval> for PgInterval
sourcefn eq(&self, other: &PgInterval) -> bool
fn eq(&self, other: &PgInterval) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PgInterval) -> bool
fn ne(&self, other: &PgInterval) -> bool
This method tests for !=
.
sourceimpl<__ST, __DB> Queryable<__ST, __DB> for PgInterval where
__DB: Backend,
Self: FromSql<__ST, __DB>,
impl<__ST, __DB> Queryable<__ST, __DB> for PgInterval where
__DB: Backend,
Self: FromSql<__ST, __DB>,
sourceimpl ToSql<Interval, Pg> for PgInterval
impl ToSql<Interval, Pg> for PgInterval
sourceimpl<__DB> ToSql<Nullable<Interval>, __DB> for PgInterval where
__DB: Backend,
Self: ToSql<Interval, __DB>,
impl<__DB> ToSql<Nullable<Interval>, __DB> for PgInterval where
__DB: Backend,
Self: ToSql<Interval, __DB>,
impl Copy for PgInterval
impl Eq for PgInterval
impl StructuralEq for PgInterval
impl StructuralPartialEq for PgInterval
Auto Trait Implementations
impl RefUnwindSafe for PgInterval
impl Send for PgInterval
impl Sync for PgInterval
impl Unpin for PgInterval
impl UnwindSafe for PgInterval
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more