pub struct EscapedQuery(/* private fields */);Expand description
A complete SQL query that has been constructed using only safe components.
This type can only be created through the sql_query! macro, which ensures
that all interpolated values implement SqlSafe.
§Example
use spawn_db::{sql_query, escape::{EscapedIdentifier, EscapedLiteral}};
let schema = EscapedIdentifier::new("public");
let name = EscapedLiteral::new("Alice");
let query = sql_query!(
"SELECT * FROM {}.users WHERE name = {}",
schema,
name
);
assert!(query.as_str().contains("\"public\""));
assert!(query.as_str().contains("'Alice'"));Implementations§
Trait Implementations§
Source§impl Clone for EscapedQuery
impl Clone for EscapedQuery
Source§fn clone(&self) -> EscapedQuery
fn clone(&self) -> EscapedQuery
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 EscapedQuery
impl Debug for EscapedQuery
Source§impl Display for EscapedQuery
impl Display for EscapedQuery
Source§impl Hash for EscapedQuery
impl Hash for EscapedQuery
Source§impl PartialEq for EscapedQuery
impl PartialEq for EscapedQuery
impl Eq for EscapedQuery
impl StructuralPartialEq for EscapedQuery
Auto Trait Implementations§
impl Freeze for EscapedQuery
impl RefUnwindSafe for EscapedQuery
impl Send for EscapedQuery
impl Sync for EscapedQuery
impl Unpin for EscapedQuery
impl UnsafeUnpin for EscapedQuery
impl UnwindSafe for EscapedQuery
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.