Struct diesel::pg::data_types::PgInterval
source · [−]postgres_backend
only.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, &'expr PgInterval>
type Expression = Bound<Interval, &'expr PgInterval>
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, PgInterval>
type Expression = Bound<Interval, PgInterval>
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>, &'expr PgInterval>
type Expression = Bound<Nullable<Interval>, &'expr PgInterval>
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>, PgInterval>
type Expression = Bound<Nullable<Interval>, PgInterval>
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 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
sourceimpl<__ST, __DB> Queryable<__ST, __DB> for PgInterval where
__DB: Backend,
__ST: SingleValue,
Self: FromSql<__ST, __DB>,
impl<__ST, __DB> Queryable<__ST, __DB> for PgInterval where
__DB: Backend,
__ST: SingleValue,
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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, ST, DB> FromSqlRow<ST, DB> for T where
T: Queryable<ST, DB>,
ST: SqlTypeOrSelectable,
DB: Backend,
<T as Queryable<ST, DB>>::Row: FromStaticSqlRow<ST, DB>,
impl<T, ST, DB> FromSqlRow<ST, DB> for T where
T: Queryable<ST, DB>,
ST: SqlTypeOrSelectable,
DB: Backend,
<T as Queryable<ST, DB>>::Row: FromStaticSqlRow<ST, DB>,
sourceimpl<T, ST, DB> FromStaticSqlRow<ST, DB> for T where
DB: Backend,
T: FromSql<ST, DB>,
ST: SingleValue,
impl<T, ST, DB> FromStaticSqlRow<ST, DB> for T where
DB: Backend,
T: FromSql<ST, DB>,
ST: SingleValue,
sourceimpl<T> IntoSql for T
impl<T> IntoSql for T
sourcefn into_sql<T>(self) -> AsExprOf<Self, T> where
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
fn into_sql<T>(self) -> AsExprOf<Self, T> where
Self: AsExpression<T> + Sized,
T: SqlType + TypedExpressionType,
Convert self
to an expression for Diesel’s query builder. Read more
sourcefn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T> where
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
fn as_sql<'a, T>(&'a self) -> AsExprOf<&'a Self, T> where
&'a Self: AsExpression<T>,
T: SqlType + TypedExpressionType,
Convert &self
to an expression for Diesel’s query builder. Read more
sourceimpl<T, ST, DB> StaticallySizedRow<ST, DB> for T where
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
impl<T, ST, DB> StaticallySizedRow<ST, DB> for T where
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
sourceconst FIELD_COUNT: usize =
const FIELD_COUNT: usize =
The number of fields that this type will consume.