pub struct SchemaName { /* private fields */ }Expand description
Represents an escaped SQL schema name with optional database qualifier.
Uses the fluent builder pattern for constructing qualified schema names.
§Example
use hyperdb_api::{SchemaName, Result};
// Simple schema name
let schema = SchemaName::try_new("public")?;
assert_eq!(schema.to_string(), "\"public\"");
// Qualified schema name using fluent builder
let qualified = SchemaName::try_new("public")?.with_database("mydb")?;
assert_eq!(qualified.to_string(), "\"mydb\".\"public\"");Implementations§
Source§impl SchemaName
impl SchemaName
Sourcepub fn try_new(schema: impl Into<String>) -> Result<Self>
pub fn try_new(schema: impl Into<String>) -> Result<Self>
Creates a new schema name without a database qualifier (the starting point).
§Errors
Returns an error if the schema name is empty or exceeds the PostgreSQL identifier limit.
§Example
use hyperdb_api::SchemaName;
let schema = SchemaName::try_new("public")?;
assert_eq!(schema.to_string(), "\"public\"");Sourcepub fn with_database(self, database: impl Into<String>) -> Result<Self>
pub fn with_database(self, database: impl Into<String>) -> Result<Self>
Builder method: Sets the database qualifier.
This method is part of the fluent builder pattern and can be chained.
Returns Result<Self> to allow fallible method chaining.
§Errors
Returns an error if the database name is empty or exceeds the PostgreSQL identifier limit.
§Example
use hyperdb_api::SchemaName;
let schema = SchemaName::try_new("public")?.with_database("mydb")?;
assert_eq!(schema.to_string(), "\"mydb\".\"public\"");Sourcepub fn database(&self) -> Option<&DatabaseName>
pub fn database(&self) -> Option<&DatabaseName>
Returns the database name, if any.
Trait Implementations§
Source§impl Clone for SchemaName
impl Clone for SchemaName
Source§fn clone(&self) -> SchemaName
fn clone(&self) -> SchemaName
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SchemaName
impl Debug for SchemaName
Source§impl Display for SchemaName
impl Display for SchemaName
Source§impl From<Name> for SchemaName
impl From<Name> for SchemaName
Source§impl FromStr for SchemaName
impl FromStr for SchemaName
Source§impl Hash for SchemaName
impl Hash for SchemaName
Source§impl PartialEq for SchemaName
impl PartialEq for SchemaName
Source§fn eq(&self, other: &SchemaName) -> bool
fn eq(&self, other: &SchemaName) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl TryFrom<&String> for SchemaName
impl TryFrom<&String> for SchemaName
Source§impl TryFrom<&str> for SchemaName
impl TryFrom<&str> for SchemaName
Source§impl TryFrom<String> for SchemaName
impl TryFrom<String> for SchemaName
impl Eq for SchemaName
impl StructuralPartialEq for SchemaName
Auto Trait Implementations§
impl Freeze for SchemaName
impl RefUnwindSafe for SchemaName
impl Send for SchemaName
impl Sync for SchemaName
impl Unpin for SchemaName
impl UnsafeUnpin for SchemaName
impl UnwindSafe for SchemaName
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<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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request