pub struct DbrestApp { /* private fields */ }Expand description
Fluent builder for constructing a dbrest axum::Router.
Use this when you want to embed dbrest in a larger application or need fine-grained control over the server lifecycle.
Implementations§
Source§impl DbrestApp
impl DbrestApp
Sourcepub fn datasource(self, ds: Datasource) -> Self
pub fn datasource(self, ds: Datasource) -> Self
Add a datasource.
Sourcepub fn with_backend(
self,
backend: Arc<dyn DatabaseBackend>,
dialect: Arc<dyn SqlDialect>,
config: AppConfig,
version: DbVersion,
) -> Self
pub fn with_backend( self, backend: Arc<dyn DatabaseBackend>, dialect: Arc<dyn SqlDialect>, config: AppConfig, version: DbVersion, ) -> Self
Convenience: add a single datasource from its raw parts.
Sourcepub fn with_admin(self) -> Self
pub fn with_admin(self) -> Self
Include the admin router (health, ready, metrics, config) at /admin.
Sourcepub fn with_prefix(self, prefix: impl Into<String>) -> Self
pub fn with_prefix(self, prefix: impl Into<String>) -> Self
Set a path prefix for all dbrest routes (e.g. “/api/v1”).
Sourcepub async fn build(self) -> Result<DbrestRouters, Error>
pub async fn build(self) -> Result<DbrestRouters, Error>
Build the axum::Router.
Loads schema caches for all datasources and wires up routing. For a single datasource, returns the standard dbrest router. For multiple datasources (future), routes by profile header.
Sourcepub async fn into_router(self) -> Result<Router, Error>
pub async fn into_router(self) -> Result<Router, Error>
Build and return only the API router (convenience for embedding).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DbrestApp
impl !RefUnwindSafe for DbrestApp
impl Send for DbrestApp
impl Sync for DbrestApp
impl Unpin for DbrestApp
impl UnsafeUnpin for DbrestApp
impl !UnwindSafe for DbrestApp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more