Struct postgresql_embedded::PostgreSQL
source · pub struct PostgreSQL { /* private fields */ }Expand description
PostgreSQL server
Implementations§
source§impl PostgreSQL
impl PostgreSQL
PostgreSQL server methods
sourcepub fn new(version: Version, settings: Settings) -> Self
pub fn new(version: Version, settings: Settings) -> Self
Create a new PostgreSQL instance
sourcepub fn default_version() -> Version
pub fn default_version() -> Version
Get the default version used if not otherwise specified
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.
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.
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.
sourcepub async fn create_database<S: AsRef<str>>(
&self,
database_name: S
) -> Result<()>
pub async fn create_database<S: AsRef<str>>( &self, database_name: S ) -> Result<()>
Create a new database with the given name.
Trait Implementations§
source§impl Clone for PostgreSQL
impl Clone for PostgreSQL
source§fn clone(&self) -> PostgreSQL
fn clone(&self) -> PostgreSQL
Returns a copy 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
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
Mutably borrows from an owned value. Read more