pub trait QueryArg {
// Required method
fn to_decoded(&self) -> DecodedValue;
}Expand description
A single query argument. Implemented for the scalars Pylon can bind, for
Option/the common Vec element types, and for DecodedValue itself
as the escape hatch for anything not covered here.
Required Methods§
fn to_decoded(&self) -> DecodedValue
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl QueryArg for DateTime<Utc>
std::datetime. Pylon stores a timestamp as microseconds from the
PostgreSQL epoch (2000-01-01), not the Unix epoch.
impl QueryArg for DateTime<Utc>
std::datetime. Pylon stores a timestamp as microseconds from the
PostgreSQL epoch (2000-01-01), not the Unix epoch.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Duration
std::duration. Pylon stores an interval as its three wire components;
months is always 0 here, since a std::time::Duration is a fixed span and
a calendar month is not (cal::relative_duration is the type that carries
one). Days stay 0 too — Postgres treats an interval’s days as
calendar-relative across a DST boundary, so the whole span goes in
microseconds.
impl QueryArg for Duration
std::duration. Pylon stores an interval as its three wire components;
months is always 0 here, since a std::time::Duration is a fixed span and
a calendar month is not (cal::relative_duration is the type that carries
one). Days stay 0 too — Postgres treats an interval’s days as
calendar-relative across a DST boundary, so the whole span goes in
microseconds.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for NaiveDate
cal::local_date.
impl QueryArg for NaiveDate
cal::local_date.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for NaiveDateTime
cal::local_datetime.
impl QueryArg for NaiveDateTime
cal::local_datetime.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for NaiveTime
cal::local_time.
impl QueryArg for NaiveTime
cal::local_time.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for String
impl QueryArg for String
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Uuid
impl QueryArg for Uuid
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Value
A json argument. Bound as JSON text rather than as a
DecodedValue::Object, because that is the form pylon-pgcon accepts
for a jsonb parameter regardless of whether the document’s root is an
object, and it saves every call site the
serde_json::to_string(&value)? it would otherwise write by hand.
impl QueryArg for Value
A json argument. Bound as JSON text rather than as a
DecodedValue::Object, because that is the form pylon-pgcon accepts
for a jsonb parameter regardless of whether the document’s root is an
object, and it saves every call site the
serde_json::to_string(&value)? it would otherwise write by hand.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<String>
impl QueryArg for Vec<String>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<Uuid>
impl QueryArg for Vec<Uuid>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<bool>
impl QueryArg for Vec<bool>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<f32>
impl QueryArg for Vec<f32>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<f64>
impl QueryArg for Vec<f64>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<i16>
impl QueryArg for Vec<i16>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<i32>
impl QueryArg for Vec<i32>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<i64>
impl QueryArg for Vec<i64>
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for Vec<u8>
Vec<u8> is bytes, not an array of integers — matching
DecodedValue::from(Vec<u8>), which takes precedence. That is also why
the array impls below are enumerated per element type instead of a
blanket impl<T: QueryArg> QueryArg for Vec<T>: the blanket form would
overlap this one, and Rust won’t accept the pair on the grounds that
u8 merely happens not to implement QueryArg today.
impl QueryArg for Vec<u8>
Vec<u8> is bytes, not an array of integers — matching
DecodedValue::from(Vec<u8>), which takes precedence. That is also why
the array impls below are enumerated per element type instead of a
blanket impl<T: QueryArg> QueryArg for Vec<T>: the blanket form would
overlap this one, and Rust won’t accept the pair on the grounds that
u8 merely happens not to implement QueryArg today.
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [String]
impl QueryArg for [String]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [Uuid]
impl QueryArg for [Uuid]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [bool]
impl QueryArg for [bool]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [f32]
impl QueryArg for [f32]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [f64]
impl QueryArg for [f64]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [i16]
impl QueryArg for [i16]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [i32]
impl QueryArg for [i32]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for [i64]
impl QueryArg for [i64]
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for bool
impl QueryArg for bool
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for f32
impl QueryArg for f32
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for f64
impl QueryArg for f64
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for i16
impl QueryArg for i16
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for i32
impl QueryArg for i32
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for i64
impl QueryArg for i64
fn to_decoded(&self) -> DecodedValue
Source§impl QueryArg for str
impl QueryArg for str
fn to_decoded(&self) -> DecodedValue
Source§impl<T: QueryArg + ?Sized> QueryArg for &T
impl<T: QueryArg + ?Sized> QueryArg for &T
fn to_decoded(&self) -> DecodedValue
Source§impl<T: QueryArg> QueryArg for Option<T>
An absent optional argument (<optional str>$x) binds as NULL.
impl<T: QueryArg> QueryArg for Option<T>
An absent optional argument (<optional str>$x) binds as NULL.