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 for PgInterval
impl Add for PgInterval
source§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
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<__ST, __DB> Queryable<__ST, __DB> for PgInterval
impl<__ST, __DB> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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.