@@ -145,6 +145,10 @@ impl PostgreSQL {
145145 /// Set up the database by extracting the archive and initializing the database.
146146 /// If the installation directory already exists, the archive will not be extracted.
147147 /// If the data directory already exists, the database will not be initialized.
148+ ///
149+ /// # Errors
150+ ///
151+ /// If the installation fails, an error will be returned.
148152 #[ instrument( skip( self ) ) ]
149153 pub async fn setup ( & mut self ) -> Result < ( ) > {
150154 match self . installed_dir ( ) {
@@ -259,6 +263,10 @@ impl PostgreSQL {
259263
260264 /// Start the database and wait for the startup to complete.
261265 /// If the port is set to `0`, the database will be started on a random port.
266+ ///
267+ /// # Errors
268+ ///
269+ /// If the database fails to start, an error will be returned.
262270 #[ instrument( skip( self ) ) ]
263271 pub async fn start ( & mut self ) -> Result < ( ) > {
264272 if self . settings . port == 0 {
@@ -299,6 +307,10 @@ impl PostgreSQL {
299307 }
300308
301309 /// Stop the database gracefully (smart mode) and wait for the shutdown to complete.
310+ ///
311+ /// # Errors
312+ ///
313+ /// If the database fails to stop, an error will be returned.
302314 #[ instrument( skip( self ) ) ]
303315 pub async fn stop ( & self ) -> Result < ( ) > {
304316 debug ! (
@@ -333,6 +345,10 @@ impl PostgreSQL {
333345 }
334346
335347 /// Create a new database with the given name.
348+ ///
349+ /// # Errors
350+ ///
351+ /// If the database creation fails, an error will be returned.
336352 #[ instrument( skip( self ) ) ]
337353 pub async fn create_database < S > ( & self , database_name : S ) -> Result < ( ) >
338354 where
@@ -359,6 +375,10 @@ impl PostgreSQL {
359375 }
360376
361377 /// Check if a database with the given name exists.
378+ ///
379+ /// # Errors
380+ ///
381+ /// If the query fails, an error will be returned.
362382 #[ instrument( skip( self ) ) ]
363383 pub async fn database_exists < S > ( & self , database_name : S ) -> Result < bool >
364384 where
@@ -383,6 +403,10 @@ impl PostgreSQL {
383403 }
384404
385405 /// Drop a database with the given name.
406+ ///
407+ /// # Errors
408+ ///
409+ /// If the database does not exist or if the drop command fails, an error will be returned.
386410 #[ instrument( skip( self ) ) ]
387411 pub async fn drop_database < S > ( & self , database_name : S ) -> Result < ( ) >
388412 where
0 commit comments