pub struct OwnedPostgres { /* private fields */ }Expand description
A verified, schema-scoped PostgreSQL pool for one Module.
Implementations§
Source§impl OwnedPostgres
impl OwnedPostgres
Sourcepub async fn prepare(
database_url: &str,
plan: SchemaPlan,
) -> Result<Self, PostgresKitError>
pub async fn prepare( database_url: &str, plan: SchemaPlan, ) -> Result<Self, PostgresKitError>
Connects and verifies the exact owned schema before exposing a pool.
This is the runtime preparation path. It never creates a schema or applies a migration.
Sourcepub async fn prepare_with_pool_options(
database_url: &str,
plan: SchemaPlan,
pool_options: PgPoolOptions,
) -> Result<Self, PostgresKitError>
pub async fn prepare_with_pool_options( database_url: &str, plan: SchemaPlan, pool_options: PgPoolOptions, ) -> Result<Self, PostgresKitError>
Connects with caller-selected pool sizing and verifies the exact schema.
Sourcepub fn schema_version(&self) -> u64
pub fn schema_version(&self) -> u64
Returns the verified schema version.
Sourcepub const fn pool(&self) -> &PgPool
pub const fn pool(&self) -> &PgPool
Returns the SQLx pool scoped to the owned schema through search_path.
Production deployments should also use one non-superuser PostgreSQL
role per Module; PostgreSQL grants, not search_path, are the security
boundary against access to another Module’s schema.
Trait Implementations§
Source§impl Clone for OwnedPostgres
impl Clone for OwnedPostgres
Source§fn clone(&self) -> OwnedPostgres
fn clone(&self) -> OwnedPostgres
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for OwnedPostgres
impl !UnwindSafe for OwnedPostgres
impl Freeze for OwnedPostgres
impl Send for OwnedPostgres
impl Sync for OwnedPostgres
impl Unpin for OwnedPostgres
impl UnsafeUnpin for OwnedPostgres
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<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> ⓘ
Converts
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> ⓘ
Converts
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