pub struct PgInterval {
pub microseconds: i64,
pub days: i32,
pub months: i32,
}
Available on crate feature
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§
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 for PgInterval
impl Add for PgInterval
Source§type Output = PgInterval
type Output = PgInterval
The resulting type after applying the
+
operator.Source§impl Arbitrary for PgInterval
Available on crate feature quickcheck
only.
impl Arbitrary for PgInterval
Available on crate feature
quickcheck
only.Source§impl<'__expr> AsExpression<Interval> for &'__expr PgInterval
impl<'__expr> AsExpression<Interval> for &'__expr PgInterval
Source§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
Source§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
Source§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
Source§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 for PgInterval
impl PartialEq for PgInterval
Source§impl<__DB, __ST> Queryable<__ST, __DB> for PgInterval
impl<__DB, __ST> Queryable<__ST, __DB> for PgInterval
impl Copy for PgInterval
impl Eq for PgInterval
impl StructuralPartialEq for PgInterval
Auto Trait Implementations§
impl Freeze for PgInterval
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 T
impl<T, ST, DB> FromStaticSqlRow<ST, DB> for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
impl<T, ST, DB> StaticallySizedRow<ST, DB> for T
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.