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 PostgreSQL
instance
Sourcepub async fn setup(&mut self) -> Result<()>
pub async 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
If the installation fails, an error will be returned.
Sourcepub async fn start(&mut self) -> Result<()>
pub async 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
If the database fails to start, an error will be returned.
Sourcepub async fn stop(&self) -> Result<()>
pub async fn stop(&self) -> Result<()>
Stop the database gracefully (smart mode) and wait for the shutdown to complete.
§Errors
If the database fails to stop, an error will be returned.
Sourcepub async fn create_database<S>(&self, database_name: S) -> Result<()>
pub async fn create_database<S>(&self, database_name: S) -> Result<()>
Create a new database with the given name.
§Errors
If the database creation fails, an error will be returned.
Sourcepub async fn database_exists<S>(&self, database_name: S) -> Result<bool>
pub async fn database_exists<S>(&self, database_name: S) -> Result<bool>
Check if a database with the given name exists.
§Errors
If the query fails, an error will be returned.
Trait Implementations§
Source§impl Clone for PostgreSQL
impl Clone for PostgreSQL
Source§fn clone(&self) -> PostgreSQL
fn clone(&self) -> PostgreSQL
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PostgreSQL
impl Debug for PostgreSQL
Source§impl Default for PostgreSQL
Default PostgreSQL
server
impl Default for PostgreSQL
Default PostgreSQL
server
Auto Trait Implementations§
impl Freeze for PostgreSQL
impl RefUnwindSafe for PostgreSQL
impl Send for PostgreSQL
impl Sync for PostgreSQL
impl Unpin 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
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>
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