Expand description
Temporal type conversion and handling.
Provides specialized conversion functions for chrono types (DateTime, NaiveDateTime, etc.) across different database drivers, optimizing for native database type support.
§Temporal Type Conversion Module
This module provides specialized handling for temporal types (DateTime, NaiveDateTime, etc.) across different database drivers. It optimizes the conversion between Rust chrono types and native database types for PostgreSQL, MySQL, and SQLite.
§Key Features
- Native Type Support: Uses database-native types when possible instead of string conversion
- Driver-Specific Optimization: Tailored conversion for each database driver
- Timezone Handling: Proper timezone conversion for DateTime
- Format Consistency: Ensures consistent date/time formats across drivers
§Supported Types
DateTime<Utc>- Timestamp with timezone (UTC)NaiveDateTime- Timestamp without timezoneNaiveDate- Date only (year, month, day)NaiveTime- Time only (hour, minute, second)
Functions§
- bind_
datetime_ fixed - Binds a
DateTime<FixedOffset>value. - bind_
datetime_ utc - Binds a
DateTime<Utc>value to a SQL query based on the database driver. - bind_
naive_ date - Binds a
NaiveDatevalue to a SQL query based on the database driver. - bind_
naive_ datetime - Binds a
NaiveDateTimevalue to a SQL query based on the database driver. - bind_
naive_ time - Binds a
NaiveTimevalue to a SQL query based on the database driver. - bind_
temporal_ value - Binds a temporal value to a SQL query based on its SQL type.
- format_
datetime_ fixed_ for_ driver - Converts a
DateTime<FixedOffset>to the format expected by a specific driver. - format_
datetime_ for_ driver - Converts a
DateTime<Utc>to the format expected by a specific driver. - format_
naive_ datetime_ for_ driver - Converts a
NaiveDateTimeto the format expected by a specific driver. - get_
postgres_ type_ cast - Returns the appropriate SQL type cast string for temporal types in PostgreSQL.
- is_
temporal_ type - Checks if a SQL type is a temporal type.
- parse_
datetime_ fixed - Parses a string into a
DateTime<FixedOffset>. - parse_
datetime_ utc - Parses a string into a
DateTime<Utc>. - parse_
naive_ date - Parses a string into a
NaiveDate. - parse_
naive_ datetime - Parses a string into a
NaiveDateTime. - parse_
naive_ time - Parses a string into a
NaiveTime.