Struct mz_repr::adt::date::Date

source ·
pub struct Date {
    days: i32,
}
Expand description

A Postgres-compatible Date. Additionally clamp valid dates for the range that chrono supports to allow for safe string operations. Infinite dates are not yet supported.

Fields§

§days: i32

Number of days from the postgres epoch (2000-01-01).

Implementations§

Largest date support by Materialize. Although Postgres can go up to 5874897-12-31, chrono is limited to December 31, 262143, which we mirror here so we can use chrono’s formatting methods and have guaranteed safe conversions.

Constructs a new Date as the days since the postgres epoch (2000-01-01).

Constructs a new Date as the days since the Unix epoch.

Returns the number of days since the postgres epoch.

Returns whether this is the infinity or -infinity date.

Currently we do not support these, so this function is a light protection against if they are added for functions that will produce incorrect results for these values.

Returns the number of days since the Unix epoch.

Returns this date with days added to it.

Trait Implementations§

The SQL column type of this Rust type
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Whether this Rust type can represent NULL values
Try to convert a Result whose Ok variant is a Datum into this native Rust type (Self). If it fails the error variant will contain the original result.
Convert this Rust type into a Result containing a Datum, or an error
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more

Format an Date in a human form

Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Increment self one step forward, if applicable. Return None if overflows.
Convert a Self into a Proto value.
Consume and convert a Proto back into a Self value. Read more
Serialize this value into the given Serde serializer. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Formats an object with the “alternative” format ({:#}) and returns it.
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Converts to this type from a reference to the input type.
Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
The type of the output value.
A well-distributed integer derived from the data.
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Wrap the input message T in a tonic::Request
Upcasts this ProgressEventTimestamp to Any. Read more
Returns the name of the concrete type of this object. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more