pub struct PgIdentifier { /* private fields */ }Expand description
A validated PostgreSQL identifier segment.
Implementations§
Source§impl PgIdentifier
impl PgIdentifier
Sourcepub fn new(input: impl AsRef<str>) -> Result<Self, PgIdentifierError>
pub fn new(input: impl AsRef<str>) -> Result<Self, PgIdentifierError>
Creates an identifier from either unquoted text or a double-quoted identifier token.
§Errors
Returns PgIdentifierError when the value is empty, malformed, or not valid for its style.
Sourcepub fn unquoted(input: impl AsRef<str>) -> Result<Self, PgIdentifierError>
pub fn unquoted(input: impl AsRef<str>) -> Result<Self, PgIdentifierError>
Creates an unquoted identifier segment using PostgreSQL-style conservative validation.
Unquoted identifiers are stored in lowercase because PostgreSQL folds unquoted names.
§Errors
Returns PgIdentifierError when the value cannot be rendered safely without quotes.
Sourcepub fn quoted(input: impl AsRef<str>) -> Result<Self, PgIdentifierError>
pub fn quoted(input: impl AsRef<str>) -> Result<Self, PgIdentifierError>
Creates a quoted identifier segment from raw identifier text.
§Errors
Returns PgIdentifierError when the value is empty or contains a control character.
Sourcepub fn from_quoted_token(input: &str) -> Result<Self, PgIdentifierError>
pub fn from_quoted_token(input: &str) -> Result<Self, PgIdentifierError>
Parses a double-quoted SQL identifier token, including doubled embedded quotes.
§Errors
Returns PgIdentifierError when the token is not a complete quoted identifier.
Sourcepub const fn style(&self) -> PgIdentifierStyle
pub const fn style(&self) -> PgIdentifierStyle
Returns the rendering style.
Sourcepub const fn is_quoted(&self) -> bool
pub const fn is_quoted(&self) -> bool
Returns true when this identifier renders with double quotes.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the identifier and returns its raw text.
Trait Implementations§
Source§impl AsRef<str> for PgIdentifier
impl AsRef<str> for PgIdentifier
Source§impl Clone for PgIdentifier
impl Clone for PgIdentifier
Source§fn clone(&self) -> PgIdentifier
fn clone(&self) -> PgIdentifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PgIdentifier
impl Debug for PgIdentifier
Source§impl Display for PgIdentifier
impl Display for PgIdentifier
Source§impl FromStr for PgIdentifier
impl FromStr for PgIdentifier
Source§impl Hash for PgIdentifier
impl Hash for PgIdentifier
Source§impl Ord for PgIdentifier
impl Ord for PgIdentifier
Source§fn cmp(&self, other: &PgIdentifier) -> Ordering
fn cmp(&self, other: &PgIdentifier) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PgIdentifier
impl PartialEq for PgIdentifier
Source§fn eq(&self, other: &PgIdentifier) -> bool
fn eq(&self, other: &PgIdentifier) -> bool
self and other values to be equal, and is used by ==.