progress-pile/progress-pile-core/src/global/database.rs
2025-05-15 07:28:06 +09:00

9 lines
No EOL
412 B
Rust

use sea_orm::{ConnectOptions, Database, DatabaseConnection};
use crate::error::Error;
pub trait GlobalDatabase {
fn get_database(&self) -> Option<&DatabaseConnection>;
async fn get_or_try_init_database(&self) -> Result<&DatabaseConnection, Error>;
async fn get_or_try_init_database_with_connect_options<T>(&self, options: T) -> Result<&DatabaseConnection, Error> where
T: Into<ConnectOptions>;
}