pub struct IdentifierQuoter { /* private fields */ }Expand description
Provides utilities for quoting identifiers in PostgreSQL as needed.
Implementations§
Source§impl IdentifierQuoter
impl IdentifierQuoter
Sourcepub fn new(keywords: HashMap<String, AllowedKeywordUsage>) -> Self
pub fn new(keywords: HashMap<String, AllowedKeywordUsage>) -> Self
Creates a new IdentifierQuoter with the specified keywords and their allowed usages.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Creates a new IdentifierQuoter with no keywords.
This is mainly useful for testing as it doesn’t require connecting to Postgres.
Sourcepub fn quote(
&self,
identifier: impl AsRef<str>,
usage: AttemptedKeywordUsage,
) -> String
pub fn quote( &self, identifier: impl AsRef<str>, usage: AttemptedKeywordUsage, ) -> String
Quotes an identifier as needed.
Sourcepub fn quote_iter<'a, 's, S: AsRef<str>, I: IntoIterator<Item = S>>(
&'a self,
identifiers: I,
usage: AttemptedKeywordUsage,
) -> impl Iterator<Item = String> + 'awhere
<I as IntoIterator>::IntoIter: 'a,
pub fn quote_iter<'a, 's, S: AsRef<str>, I: IntoIterator<Item = S>>(
&'a self,
identifiers: I,
usage: AttemptedKeywordUsage,
) -> impl Iterator<Item = String> + 'awhere
<I as IntoIterator>::IntoIter: 'a,
Quotes multiple identifiers as needed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IdentifierQuoter
impl RefUnwindSafe for IdentifierQuoter
impl Send for IdentifierQuoter
impl Sync for IdentifierQuoter
impl Unpin for IdentifierQuoter
impl UnwindSafe for IdentifierQuoter
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> 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