Trait ToSqlx

Source
pub trait ToSqlx {
    type Target;

    // Required method
    fn to_sqlx(self) -> Self::Target;
}
Expand description

A trait for convenient conversions from Jiff types to SQLx types.

§Example

This shows how to convert a jiff::Timestamp to a Timestamp:

use jiff_sqlx::ToSqlx;

let ts: jiff::Timestamp = "2025-02-20T17:00-05".parse()?;
let wrapper = ts.to_sqlx();
assert_eq!(format!("{wrapper:?}"), "Timestamp(2025-02-20T22:00:00Z)");

Required Associated Types§

Source

type Target

The wrapper type to convert to.

Required Methods§

Source

fn to_sqlx(self) -> Self::Target

A conversion method that converts a Jiff type to a SQLx wrapper type.

Implementations on Foreign Types§

Source§

impl ToSqlx for Date

Source§

impl ToSqlx for DateTime

Source§

impl ToSqlx for Time

Source§

impl ToSqlx for Span

Source§

impl ToSqlx for Timestamp

Implementors§