Module temporal

Module temporal 

Source
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 timezone
  • NaiveDate - 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 NaiveDate value to a SQL query based on the database driver.
bind_naive_datetime
Binds a NaiveDateTime value to a SQL query based on the database driver.
bind_naive_time
Binds a NaiveTime value 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 NaiveDateTime to 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.