pub struct EscapedIdentifier { /* private fields */ }Expand description
A PostgreSQL identifier (schema, table, column name) that has been safely escaped.
The value is escaped at construction time using PostgreSQL’s quote_ident rules:
- Wrapped in double quotes
- Any embedded double quotes are doubled
§Example
use spawn_db::escape::EscapedIdentifier;
let schema = EscapedIdentifier::new("my_schema");
assert_eq!(schema.as_str(), "\"my_schema\"");
let tricky = EscapedIdentifier::new("schema\"name");
assert_eq!(tricky.as_str(), "\"schema\"\"name\"");Implementations§
Source§impl EscapedIdentifier
impl EscapedIdentifier
Sourcepub fn new(raw: &str) -> Self
pub fn new(raw: &str) -> Self
Creates a new escaped identifier from a raw string.
The input is immediately escaped using PostgreSQL’s identifier escaping rules.
Trait Implementations§
Source§impl Clone for EscapedIdentifier
impl Clone for EscapedIdentifier
Source§fn clone(&self) -> EscapedIdentifier
fn clone(&self) -> EscapedIdentifier
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 EscapedIdentifier
impl Debug for EscapedIdentifier
Source§impl Display for EscapedIdentifier
impl Display for EscapedIdentifier
Source§impl Hash for EscapedIdentifier
impl Hash for EscapedIdentifier
Source§impl PartialEq for EscapedIdentifier
impl PartialEq for EscapedIdentifier
Source§impl SqlSafe for EscapedIdentifier
impl SqlSafe for EscapedIdentifier
impl Eq for EscapedIdentifier
impl StructuralPartialEq for EscapedIdentifier
Auto Trait Implementations§
impl Freeze for EscapedIdentifier
impl RefUnwindSafe for EscapedIdentifier
impl Send for EscapedIdentifier
impl Sync for EscapedIdentifier
impl Unpin for EscapedIdentifier
impl UnwindSafe for EscapedIdentifier
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> 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 moreSource§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.