pub type Database = DbConnection;Expand description
Injectable database connection type
This is an alias for DbConnection that can be used with dependency injection.
Use with the #[inject] attribute in actions and services for cleaner database access.
§Example
ⓘ
use ferro_rs::{injectable, Database};
#[injectable]
pub struct CreateUserAction {
#[inject]
db: Database,
}
impl CreateUserAction {
pub async fn execute(&self) {
let users = User::find().all(self.db.conn()).await?;
}
}Aliased Type§
pub struct Database { /* private fields */ }