Interval in sqlparser::ast - Rust

pub struct Interval {
    pub value: Box<Expr>,
    pub leading_field: Option<DateTimeField>,
    pub leading_precision: Option<u64>,
    pub last_field: Option<DateTimeField>,
    pub fractional_seconds_precision: Option<u64>,
}
Expand description

Represents an INTERVAL expression, roughly in the following format: INTERVAL '<value>' [ <leading_field> [ (<leading_precision>) ] ] [ TO <last_field> [ (<fractional_seconds_precision>) ] ], e.g. INTERVAL '123:45.67' MINUTE(3) TO SECOND(2).

The parser does not validate the <value>, nor does it ensure that the <leading_field> units >= the units in <last_field>, so the user will have to reject intervals like HOUR TO YEAR.

The interval value expression (commonly a string literal).

Optional leading time unit (e.g., HOUR, MINUTE).

Optional leading precision for the leading field.

Optional trailing time unit for a range (e.g., SECOND).

The fractional seconds precision, when specified.

See SQL SECOND(n) or SECOND(m, n) forms.

§
§
§
§
§
§