pub struct PgSettings {
pub database_dir: PathBuf,
pub port: u16,
pub user: String,
pub password: String,
pub auth_method: PgAuthMethod,
pub persistent: bool,
pub timeout: Option<Duration>,
pub migration_dir: Option<PathBuf>,
}Expand description
Configuration for a single embedded PostgreSQL instance.
Fields§
§database_dir: PathBufDirectory that will hold the PostgreSQL cluster data files.
Created automatically if it does not exist. When Self::persistent
is false this directory (and Self::database_dir with a .pwfile
extension) is removed when PgEmbed is dropped.
port: u16TCP port PostgreSQL will listen on.
user: StringName of the initial database superuser.
password: StringPassword for the superuser, written to a temporary password file and
passed to initdb via --pwfile.
auth_method: PgAuthMethodAuthentication method written to pg_hba.conf by initdb.
persistent: boolIf false, the cluster directory and password file are deleted when
the PgEmbed instance is dropped. Set to true to keep the data
across runs.
timeout: Option<Duration>Maximum time to wait for initdb, pg_ctl start, and pg_ctl stop
to complete.
None disables the timeout (the process is waited on indefinitely).
Exceeding the timeout returns Error::PgTimedOutError.
migration_dir: Option<PathBuf>Directory containing .sql migration files.
When Some, PgEmbed::migrate will run all migrations found in
this directory via sqlx. None disables migrations.
Requires the rt_tokio_migrate feature.
Auto Trait Implementations§
impl Freeze for PgSettings
impl RefUnwindSafe for PgSettings
impl Send for PgSettings
impl Sync for PgSettings
impl Unpin for PgSettings
impl UnsafeUnpin for PgSettings
impl UnwindSafe for PgSettings
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> 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