generated from alecodes/base-template
23 lines
489 B
Rust
23 lines
489 B
Rust
pub mod static_assets;
|
|
pub mod config;
|
|
mod error;
|
|
pub mod router;
|
|
|
|
use crate::static_assets::Assets;
|
|
use axum::extract::FromRef;
|
|
pub use error::{Error, Result, ResultTemplate};
|
|
|
|
pub type Tx = axum_sqlx_tx::Tx<sqlx::Postgres>;
|
|
pub type TxState = axum_sqlx_tx::State<sqlx::Postgres>;
|
|
|
|
#[derive(Clone, FromRef)]
|
|
pub struct AppState {
|
|
pub assets: Assets,
|
|
pub tx: TxState,
|
|
}
|
|
|
|
impl AppState {
|
|
pub fn new(assets: Assets, tx: TxState) -> Self {
|
|
AppState { assets, tx }
|
|
}
|
|
}
|