pub trait ToSql {
// Required method
fn to_sql(&self) -> Result<ToSqlOutput<'_>>;
}
Expand description
A trait for types that can be converted into SQLite values. Returns
Error::ToSqlConversionFailure
if the conversion fails.
Required Methods§
sourcefn to_sql(&self) -> Result<ToSqlOutput<'_>>
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
Converts Rust value to SQLite value
Implementations on Foreign Types§
source§impl ToSql for Value
Available on crate feature serde_json
only.
impl ToSql for Value
serde_json
only.Serialize JSON Value
to text:
JSON | SQLite |
---|---|
Null | NULL |
Bool | ‘true’ / ‘false’ |
Number | INT or REAL except u64 |
_ | TEXT |
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for DateTime<FixedOffset>
Available on crate feature chrono
only.
impl ToSql for DateTime<FixedOffset>
chrono
only.Date and time with time zone => RFC3339 timestamp (“YYYY-MM-DD HH:MM:SS.SSS[+-]HH:MM”).
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for DateTime<Local>
Available on crate feature chrono
only.
impl ToSql for DateTime<Local>
chrono
only.Local time => UTC RFC3339 timestamp (“YYYY-MM-DD HH:MM:SS.SSS+00:00”).
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for DateTime<Utc>
Available on crate feature chrono
only.
impl ToSql for DateTime<Utc>
chrono
only.UTC time => UTC RFC3339 timestamp (“YYYY-MM-DD HH:MM:SS.SSS+00:00”).
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NaiveDate
Available on crate feature chrono
only.
impl ToSql for NaiveDate
chrono
only.ISO 8601 calendar date without timezone => “YYYY-MM-DD”
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NaiveDateTime
Available on crate feature chrono
only.
impl ToSql for NaiveDateTime
chrono
only.ISO 8601 combined date and time without timezone => “YYYY-MM-DD HH:MM:SS.SSS”
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NaiveTime
Available on crate feature chrono
only.
impl ToSql for NaiveTime
chrono
only.ISO 8601 time without timezone => “HH:MM:SS.SSS”
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for Date
Available on crate feature time
only.
impl ToSql for Date
time
only.ISO 8601 calendar date without timezone => “YYYY-MM-DD”
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for OffsetDateTime
Available on crate feature time
only.
impl ToSql for OffsetDateTime
time
only.OffsetDatetime => RFC3339 format (“YYYY-MM-DD HH:MM:SS.SSS[+-]HH:MM”)
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for PrimitiveDateTime
Available on crate feature time
only.
impl ToSql for PrimitiveDateTime
time
only.ISO 8601 combined date and time without timezone => “YYYY-MM-DD HH:MM:SS.SSS”
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for Time
Available on crate feature time
only.
impl ToSql for Time
time
only.ISO 8601 time without timezone => “HH:MM:SS.SSS”
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for Url
Available on crate feature url
only.
impl ToSql for Url
url
only.Serialize Url
to text.
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroI16
impl ToSql for NonZeroI16
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroI32
impl ToSql for NonZeroI32
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroI64
impl ToSql for NonZeroI64
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroI128
impl ToSql for NonZeroI128
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroIsize
impl ToSql for NonZeroIsize
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroU16
impl ToSql for NonZeroU16
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroU32
impl ToSql for NonZeroU32
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroU64
impl ToSql for NonZeroU64
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl ToSql for NonZeroUsize
impl ToSql for NonZeroUsize
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
source§impl<T: ToSql + ToOwned + ?Sized> ToSql for Cow<'_, T>
impl<T: ToSql + ToOwned + ?Sized> ToSql for Cow<'_, T>
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
Implementors§
impl ToSql for ToSqlOutput<'_>
impl ToSql for rusqlite::types::Value
impl ToSql for ZeroBlob
blob
only.impl ToSql for SqlFnArg
functions
only.impl ToSql for Null
impl ToSql for Array
array
and vtab
only.