pub struct SchemaName(/* private fields */);Expand description
The Postgres schema River’s tables live in.
SchemaName::current uses the connection’s current schema (normally
public, following search_path). An explicit schema is quoted wherever
River renders it, so names such as river-prod or MyRiver work as
written. Pass the same schema to the
migrator and the client.
use riverqueue_migrate::SchemaName;
let schema = SchemaName::new("river")?;
assert_eq!(schema.qualify("river_job"), r#""river"."river_job""#);Implementations§
Source§impl SchemaName
impl SchemaName
Sourcepub fn new(schema: impl Into<String>) -> Result<Self, SchemaNameError>
pub fn new(schema: impl Into<String>) -> Result<Self, SchemaNameError>
Validates an optional explicit schema.
Any name is accepted and quoted when rendered, including mixed case
and punctuation such as
river-prod. Names containing NUL are rejected, as are names too long
to prefix River’s notification topics within Postgres’s identifier
limit.
§Errors
Returns an error when the schema is too long or contains NUL.
Sourcepub fn qualify(&self, object: &str) -> String
pub fn qualify(&self, object: &str) -> String
Qualifies and quotes a database object name in this schema, for use in SQL that refers to River’s tables.
Sourcepub fn quoted_identifier(&self) -> Option<String>
pub fn quoted_identifier(&self) -> Option<String>
Returns the explicit schema quoted as a Postgres identifier, for
SQL that names the schema itself, or None for the connection’s
current schema.
Trait Implementations§
Source§impl Clone for SchemaName
impl Clone for SchemaName
Source§impl Debug for SchemaName
impl Debug for SchemaName
Source§impl Default for SchemaName
impl Default for SchemaName
Source§impl Display for SchemaName
impl Display for SchemaName
impl Eq for SchemaName
Source§impl PartialEq for SchemaName
impl PartialEq 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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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