pub struct PostgreSQL { /* private fields */ }Expand description
PostgreSQL server
Implementations§
Source§impl PostgreSQL
PostgreSQL server methods
impl PostgreSQL
PostgreSQL server methods
Sourcepub fn new(settings: Settings) -> Self
pub fn new(settings: Settings) -> Self
Create a new crate::postgresql::PostgreSQL instance
Sourcepub fn setup(&mut self) -> Result<()>
pub fn setup(&mut self) -> Result<()>
Set up the database by extracting the archive and initializing the database. If the installation directory already exists, the archive will not be extracted. If the data directory already exists, the database will not be initialized.
§Errors
Returns an error if the setup fails.
Sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Start the database and wait for the startup to complete.
If the port is set to 0, the database will be started on a random port.
§Errors
Returns an error if the startup fails.
Sourcepub fn stop(&self) -> Result<()>
pub fn stop(&self) -> Result<()>
Stop the database gracefully (smart mode) and wait for the shutdown to complete.
§Errors
Returns an error if the shutdown fails.
Sourcepub fn create_database<S>(&self, database_name: S) -> Result<()>
pub fn create_database<S>(&self, database_name: S) -> Result<()>
Sourcepub fn database_exists<S>(&self, database_name: S) -> Result<bool>
pub fn database_exists<S>(&self, database_name: S) -> Result<bool>
Check if a database with the given name exists.
§Errors
Returns an error if the database existence check fails.
Trait Implementations§
Source§impl Clone for PostgreSQL
impl Clone for PostgreSQL
Source§fn clone(&self) -> PostgreSQL
fn clone(&self) -> PostgreSQL
Returns a duplicate of the value. Read more
1.0.0 · 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 PostgreSQL
impl Debug for PostgreSQL
Source§impl Default for PostgreSQL
impl Default for PostgreSQL
Source§fn default() -> PostgreSQL
fn default() -> PostgreSQL
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PostgreSQL
impl RefUnwindSafe for PostgreSQL
impl Send for PostgreSQL
impl Sync for PostgreSQL
impl Unpin for PostgreSQL
impl UnsafeUnpin for PostgreSQL
impl UnwindSafe for PostgreSQL
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