pub struct OrmModule;Expand description
The ORM’s module. Global; provides and exports OrmRuntime.
- reads the
[orm]section (OrmOptions): the strict modes, by default on except in production; - installs, at boot, the global scopes modules register
(
ModuleBuilderOrmExt::global_scope); when a module of a plugin that is not one of the framework’s own packages registers one on a model of another crate, the boot fails before strict mode or any scope is installed; - keeps the registry of the app’s models
(
ModuleBuilderOrmExt::model) for tooling; - registers the commands
model:prune(seeprune) andmodel:show(seeshow) and the joborm.broadcast(queued model broadcasts, seebroadcast).
The ORM works without it (models need no module); add it to configure strict modes and their handlers, or let a module that registers scopes or models import it for you.
use navree_kernel::Navree;
use navree_orm::OrmModule;
Navree::app()
.module(
OrmModule::from_config().on_lazy_loading(|violation| {
tracing::warn!(%violation, "lazy loading"); // log instead of failing
Ok(())
}),
)
.run()Implementations§
Source§impl OrmModule
impl OrmModule
Sourcepub fn for_root(options: OrmOptions) -> ConfiguredOrmModule
pub fn for_root(options: OrmOptions) -> ConfiguredOrmModule
The module with explicit options.
Sourcepub fn from_config() -> ConfiguredOrmModule
pub fn from_config() -> ConfiguredOrmModule
The module configured from the [orm] section at boot.
Trait Implementations§
impl Copy for OrmModule
Source§impl Module for OrmModule
impl Module for OrmModule
Source§fn register(&self, m: &mut ModuleBuilder)
fn register(&self, m: &mut ModuleBuilder)
Registers everything the module contributes.
Source§fn id(&self) -> ModuleId
fn id(&self) -> ModuleId
The module identity.
for_root wrappers override this to return the id
of the module type they configure.Source§fn is_configured(&self) -> bool
fn is_configured(&self) -> bool
for_root(...) values return true; at most one configured instance per id.Auto Trait Implementations§
impl Forget for OrmModule
impl Freeze for OrmModule
impl Move for OrmModule
impl RefUnwindSafe for OrmModule
impl Send for OrmModule
impl Sync for OrmModule
impl Unpin for OrmModule
impl UnsafeUnpin for OrmModule
impl UnwindSafe for OrmModule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<M> IntoModules for Mwhere
M: Module,
impl<M> IntoModules for Mwhere
M: Module,
fn into_passed_modules(self) -> Vec<PassedModule>
Source§impl<T> ValueFor<Option<T>> for T
impl<T> ValueFor<Option<T>> for T
Source§fn into_value_for(self) -> Option<T>
fn into_value_for(self) -> Option<T>
The value as the column’s type.