bind_datetime_utc

Function bind_datetime_utc 

Source
pub fn bind_datetime_utc(
    query_args: &mut AnyArguments<'_>,
    value: &DateTime<Utc>,
    driver: &Drivers,
) -> Result<(), Error>
Expand description

Binds a DateTime<Utc> value to a SQL query based on the database driver.

§Arguments

  • query_args - The SQLx AnyArguments to bind the value to
  • value - The DateTime value to bind
  • driver - The database driver being used

§Database-Specific Behavior

§PostgreSQL

  • Uses native TIMESTAMPTZ type
  • Stores as UTC timestamp
  • Format: RFC 3339 (ISO 8601)

§MySQL

  • Converts to TIMESTAMP type
  • Stores as UTC, converts based on session timezone
  • Note: Limited to dates before 2038-01-19 (Y2038 problem)

§SQLite

  • Stores as TEXT in ISO 8601 format
  • Format: “YYYY-MM-DD HH:MM:SS.SSS+00:00”