pub struct TableName { /* private fields */ }Expand description
Represents a fully qualified SQL table name.
A table name can optionally include database and schema qualifiers. Uses the fluent builder pattern for constructing qualified table names.
§Example
use hyperdb_api::{TableName, Result};
// Simple table name
let table = TableName::try_new("users")?;
assert_eq!(table.to_string(), "\"users\"");
// With schema using fluent builder
let with_schema = TableName::try_new("users")?.with_schema("public")?;
assert_eq!(with_schema.to_string(), "\"public\".\"users\"");
// Fully qualified using fluent builder
let full = TableName::try_new("users")?
.with_schema("public")?
.with_database("mydb")?;
assert_eq!(full.to_string(), "\"mydb\".\"public\".\"users\"");Implementations§
Source§impl TableName
impl TableName
Sourcepub fn with_schema(self, schema: impl Into<String>) -> Result<Self>
pub fn with_schema(self, schema: impl Into<String>) -> Result<Self>
Builder method: Sets the schema 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 schema name is empty or exceeds the PostgreSQL identifier limit.
§Example
use hyperdb_api::TableName;
let table = TableName::try_new("users")?.with_schema("public")?;
assert_eq!(table.to_string(), "\"public\".\"users\"");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::TableName;
let table = TableName::try_new("users")?
.with_schema("public")?
.with_database("mydb")?;
assert_eq!(table.to_string(), "\"mydb\".\"public\".\"users\"");Sourcepub fn database(&self) -> Option<&DatabaseName>
pub fn database(&self) -> Option<&DatabaseName>
Returns the database name, if any.
Trait Implementations§
impl Eq for TableName
impl StructuralPartialEq for TableName
Auto Trait Implementations§
impl Freeze for TableName
impl RefUnwindSafe for TableName
impl Send for TableName
impl Sync for TableName
impl Unpin for TableName
impl UnsafeUnpin for TableName
impl UnwindSafe for TableName
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