//! # Initialize database pool connection //! //! ``` //! use database_pool::Pool; //! //! # async fn get_database() { //! let database = Pool::init("/path/to/database.sqlite").await.expect("Failed to init pool"); //! //! // Close pool //! database.close().await; //! # } //! ``` //! //! # Run migrations to pool //! //! ``` //! use database_pool::Pool; //! use database_pool::run_migrations; //! //! # async fn migrations() { //! # let database = Pool::init("/path/to/database.sqlite").await.unwrap(); //! run_migrations(&database.pool).await.expect("Failed to run migrations"); //! # } //! ``` //! //! # Run transaction on database //! //! ``` //! use database_pool::Pool; //! //! # async fn run_transaction() { //! # let database = Pool::init("/path/to/database.sqlite").await.unwrap(); //! // Start transaction //! let mut transaction = database.pool.begin().await.expect("Failed to start transaction"); //! //! // Run functions requiring database //! //! // Commit transaction //! transaction.commit().await.expect("Failed to commit transaction"); //! //! // Do what you need :) //! //! # } //! ``` mod migrations; mod pool; pub use migrations::run_migrations; pub use pool::Pool;