Struct diesel::pg::data_types::PgInterval
source · pub struct PgInterval {
pub microseconds: i64,
pub days: i32,
pub months: i32,
}
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§
source§impl 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§
source§impl Add<PgInterval> for PgInterval
impl Add<PgInterval> for PgInterval
§type Output = PgInterval
type Output = PgInterval
The resulting type after applying the
+
operator.source§impl<'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
source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
source§impl AsExpression<Interval> for PgInterval
impl AsExpression<Interval> for PgInterval
§type Expression = Bound<Interval, PgInterval>
type Expression = Bound<Interval, PgInterval>
The expression being returned
source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
source§impl<'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
source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
source§impl 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
source§fn as_expression(self) -> Self::Expression
fn as_expression(self) -> Self::Expression
Perform the conversion
source§impl Clone for PgInterval
impl Clone for PgInterval
source§fn clone(&self) -> PgInterval
fn clone(&self) -> PgInterval
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PgInterval
impl Debug for PgInterval
source§impl PartialEq<PgInterval> for PgInterval
impl PartialEq<PgInterval> for PgInterval
source§fn 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 ==
.source§impl<__ST, __DB> Queryable<__ST, __DB> for PgIntervalwhere
__DB: Backend,
__ST: SingleValue,
Self: FromSql<__ST, __DB>,
impl<__ST, __DB> Queryable<__ST, __DB> for PgIntervalwhere __DB: Backend, __ST: SingleValue, Self: FromSql<__ST, __DB>,
source§impl<__DB> ToSql<Nullable<Interval>, __DB> for PgIntervalwhere
__DB: Backend,
Self: ToSql<Interval, __DB>,
impl<__DB> ToSql<Nullable<Interval>, __DB> for PgIntervalwhere __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§
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, ST, DB> FromSqlRow<ST, DB> for Twhere
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 Twhere T: Queryable<ST, DB>, ST: SqlTypeOrSelectable, DB: Backend, <T as Queryable<ST, DB>>::Row: FromStaticSqlRow<ST, DB>,
source§impl<T, ST, DB> FromStaticSqlRow<ST, DB> for Twhere
DB: Backend,
T: FromSql<ST, DB>,
ST: SingleValue,
impl<T, ST, DB> FromStaticSqlRow<ST, DB> for Twhere DB: Backend, T: FromSql<ST, DB>, ST: SingleValue,
source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn 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 moresource§fn 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 moresource§impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere ST: SqlTypeOrSelectable + TupleSize, T: Queryable<ST, DB>, DB: Backend,
source§const FIELD_COUNT: usize = const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE;
const FIELD_COUNT: usize = const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE;
The number of fields that this type will consume.