Skip to main content

QueryArg

Trait QueryArg 

Source
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§

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.

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.

Source§

impl QueryArg for NaiveDate

cal::local_date.

Source§

impl QueryArg for NaiveDateTime

cal::local_datetime.

Source§

impl QueryArg for NaiveTime

cal::local_time.

Source§

impl QueryArg for String

Source§

impl QueryArg for Uuid

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.

Source§

impl QueryArg for Vec<String>

Source§

impl QueryArg for Vec<Uuid>

Source§

impl QueryArg for Vec<bool>

Source§

impl QueryArg for Vec<f32>

Source§

impl QueryArg for Vec<f64>

Source§

impl QueryArg for Vec<i16>

Source§

impl QueryArg for Vec<i32>

Source§

impl QueryArg for Vec<i64>

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.

Source§

impl QueryArg for [String]

Source§

impl QueryArg for [Uuid]

Source§

impl QueryArg for [bool]

Source§

impl QueryArg for [f32]

Source§

impl QueryArg for [f64]

Source§

impl QueryArg for [i16]

Source§

impl QueryArg for [i32]

Source§

impl QueryArg for [i64]

Source§

impl QueryArg for bool

Source§

impl QueryArg for f32

Source§

impl QueryArg for f64

Source§

impl QueryArg for i16

Source§

impl QueryArg for i32

Source§

impl QueryArg for i64

Source§

impl QueryArg for str

Source§

impl<T: QueryArg + ?Sized> QueryArg for &T

Source§

impl<T: QueryArg> QueryArg for Option<T>

An absent optional argument (<optional str>$x) binds as NULL.

Implementors§