Struct tidb_query_datatype::codec::mysql::duration::Duration[][src]

#[repr(C)]pub struct Duration {
    nanos: i64,
    fsp: u8,
}

Fields

nanos: i64fsp: u8

Implementations

impl Duration[src]

pub fn is_neg(self) -> bool[src]

pub fn hours(self) -> u32[src]

pub fn minutes(self) -> u32[src]

pub fn secs(self) -> u32[src]

pub fn subsec_micros(self) -> u32[src]

Returns the fractional part of Duration in microseconds.

pub fn subsec_nanos(self) -> u32[src]

Returns the fractional part of Duration in nanoseconds.

pub fn fsp(self) -> u8[src]

pub fn minimize_fsp(self) -> Self[src]

pub fn maximize_fsp(self) -> Self[src]

pub fn to_secs(self) -> i64[src]

pub fn to_secs_f64(self) -> f64[src]

Returns the number of seconds contained by this Duration as f64. The returned value does include the fractional (nanosecond) part of the duration.

pub fn to_millis(self) -> i64[src]

pub fn to_micros(self) -> i64[src]

pub fn to_nanos(self) -> i64[src]

pub fn zero() -> Duration[src]

Returns the identity element of Duration

pub fn is_zero(self) -> bool[src]

Returns true if self is equal to the additive identity.

pub fn abs(self) -> Self[src]

Returns the absolute value of Duration

pub fn from_secs(secs: i64, fsp: i8) -> Result<Duration>[src]

pub fn from_millis(millis: i64, fsp: i8) -> Result<Duration>[src]

pub fn from_micros(micros: i64, fsp: i8) -> Result<Duration>[src]

pub fn from_nanos(nanos: i64, fsp: i8) -> Result<Duration>[src]

pub fn new_from_parts(
    neg: bool,
    hour: u32,
    minute: u32,
    second: u32,
    nanos: u32,
    fsp: i8
) -> Result<Duration>
[src]

pub fn parse(ctx: &mut EvalContext, input: &str, fsp: i8) -> Result<Duration>[src]

Parses the time from a formatted string with a fractional seconds part, returns the duration type Time value. See: http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html

pub fn parse_consider_overflow(
    ctx: &mut EvalContext,
    input: &str,
    fsp: i8,
    overflow_as_null: bool
) -> Result<Duration>
[src]

pub fn parse_exactly(
    ctx: &mut EvalContext,
    input: &str,
    fsp: i8
) -> Result<Duration>
[src]

Parses the input exactly as duration and will not fallback to datetime.

pub fn round_frac(self, fsp: i8) -> Result<Self>[src]

Rounds fractional seconds precision with new FSP and returns a new one. We will use the “round half up” rule, e.g, >= 0.5 -> 1, < 0.5 -> 0, so 10:10:10.999999 round with fsp: 1 -> 10:10:11.0 and 10:10:10.000000 round with fsp: 0 -> 10:10:11

pub fn checked_add(self, rhs: Duration) -> Option<Duration>[src]

Checked duration addition. Computes self + rhs, returning None if overflow occurred.

pub fn checked_sub(self, rhs: Duration) -> Option<Duration>[src]

Checked duration subtraction. Computes self - rhs, returning None if overflow occurred.

fn format(self, sep: &str) -> String[src]

pub fn to_numeric_string(self) -> String[src]

Converts a Duration to printable numeric string representation

pub fn from_i64(ctx: &mut EvalContext, n: i64, fsp: i8) -> Result<Duration>[src]

Trait Implementations

impl AsMySQLBool for Duration[src]

impl Clone for Duration[src]

impl ConvertTo<Decimal> for Duration[src]

fn convert(&self, _: &mut EvalContext) -> Result<Decimal>[src]

This function should not return err, if it return err, then the err is because of bug.

Port from TiDB’ Duration::ToNumber

impl ConvertTo<Duration> for Time[src]

fn convert(&self, _: &mut EvalContext) -> Result<Duration>[src]

Port from TiDB’s Time::ConvertToDuration

impl ConvertTo<Json> for Duration[src]

impl ConvertTo<f64> for Duration[src]

impl Copy for Duration[src]

impl Debug for Duration[src]

impl Display for Duration[src]

impl Eq for Duration[src]

impl Evaluable for Duration[src]

impl EvaluableRet for Duration[src]

type ChunkedType = ChunkedVecSized<Self>

impl From<Duration> for ScalarValue[src]

impl From<Duration> for Datum[src]

impl Hash for Duration[src]

impl Ord for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl<'a> RawDatumDecoder<Duration> for &'a [u8][src]

impl ToInt for Duration[src]

impl VectorValueExt<Duration> for VectorValue[src]

Auto Trait Implementations

impl RefUnwindSafe for Duration

impl Send for Duration

impl Sync for Duration

impl Unpin for Duration

impl UnwindSafe for Duration

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> ConvertTo<NotNan<f64>> for T where
    T: ConvertTo<f64> + EvaluableRet
[src]

impl<T> ConvertTo<String> for T where
    T: ToString + EvaluableRet
[src]

impl<T> ConvertTo<Vec<u8, Global>> for T where
    T: ToString + EvaluableRet
[src]

impl<T> ConvertTo<i64> for T where
    T: ToInt
[src]

impl<T> ConvertTo<u64> for T where
    T: ToInt
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]