TypedString in sqlparser::ast - Rust

Struct TypedString 

Source

pub struct TypedString {
    pub data_type: DataType,
    pub value: ValueWithSpan,
    pub uses_odbc_syntax: bool,
}
Expand description

A constant of form <data_type> 'value'. This can represent ANSI SQL DATE, TIME, and TIMESTAMP literals (such as DATE '2020-01-01'), as well as constants of other types (a non-standard PostgreSQL extension).

The data type of the typed string (e.g. DATE, TIME, TIMESTAMP).

The value of the constant. Hint: you can unwrap the string value using value.into_string().

Flags whether this TypedString uses the [ODBC syntax].

Example:

-- An ODBC date literal:
SELECT {d '2025-07-16'}
-- This is equivalent to the standard ANSI SQL literal:
SELECT DATE '2025-07-16'

[ODBC syntax]: https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/date-time-and-timestamp-literals?view=sql-server-2017

§
§
§
§
§
§