#[non_exhaustive]pub enum QueryParam {
Null,
Bool(bool),
Int(i32),
BigInt(i64),
Float(f32),
Double(f64),
Text(String),
Json(Value),
}Expand description
Typed parameter wrapper that preserves JSON value types for PostgreSQL wire protocol.
This enum ensures type information is preserved when converting GraphQL input values to PostgreSQL parameters, avoiding protocol errors from type mismatches.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Null
SQL NULL value
Bool(bool)
Boolean value
Int(i32)
32-bit integer
BigInt(i64)
64-bit integer (BIGINT)
Float(f32)
32-bit floating point
Double(f64)
64-bit floating point (DOUBLE PRECISION)
Text(String)
Text/string value (TEXT/VARCHAR)
Json(Value)
JSON/JSONB value (for arrays and objects)
Trait Implementations§
Source§impl Clone for QueryParam
impl Clone for QueryParam
Source§fn clone(&self) -> QueryParam
fn clone(&self) -> QueryParam
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QueryParam
impl Debug for QueryParam
Source§impl From<Value> for QueryParam
Available on crate feature postgres only.
impl From<Value> for QueryParam
Available on crate feature
postgres only.Source§impl ToSql for QueryParam
Available on crate feature postgres only.
impl ToSql for QueryParam
Available on crate feature
postgres only.Source§fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql_checked( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
An adaptor method used internally by Rust-Postgres. Read more
Source§fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql( &self, ty: &Type, out: &mut BytesMut, ) -> Result<IsNull, Box<dyn Error + Sync + Send>>
Converts the value of
self into the binary format of the specified
Postgres Type, appending it to out. Read moreSource§fn accepts(_ty: &Type) -> bool
fn accepts(_ty: &Type) -> bool
Determines if a value of this type can be converted to the specified
Postgres
Type.Source§fn encode_format(&self, _ty: &Type) -> Format
fn encode_format(&self, _ty: &Type) -> Format
Specify the encode format
Auto Trait Implementations§
impl Freeze for QueryParam
impl RefUnwindSafe for QueryParam
impl Send for QueryParam
impl Sync for QueryParam
impl Unpin for QueryParam
impl UnsafeUnpin for QueryParam
impl UnwindSafe for QueryParam
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
Source§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self as a ToSql trait object.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more