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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more