pub struct SystemConfigDbStore { /* private fields */ }Expand description
SeaORM-backed system configuration store.
The registry supplies metadata, not write validation. See Self::upsert_prevalidated.
Implementations§
Source§impl SystemConfigDbStore
impl SystemConfigDbStore
Sourcepub const fn new(
db: DatabaseConnection,
registry: &'static ConfigRegistry,
deprecated_keys: &'static [&'static str],
) -> Self
pub const fn new( db: DatabaseConnection, registry: &'static ConfigRegistry, deprecated_keys: &'static [&'static str], ) -> Self
Creates a store from a database connection and product config registry.
Sourcepub async fn find_cursor(
&self,
limit: u64,
after_id: Option<i64>,
) -> Result<SystemConfigCursorSlice>
pub async fn find_cursor( &self, limit: u64, after_id: Option<i64>, ) -> Result<SystemConfigCursorSlice>
Lists one id-cursor page by stable id order.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn find_visible_custom(
&self,
include_authenticated: bool,
) -> Result<Vec<Model>>
pub async fn find_visible_custom( &self, include_authenticated: bool, ) -> Result<Vec<Model>>
Lists visible custom rows ordered by key.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn lock_by_key(&self, key: &str) -> Result<()>
pub async fn lock_by_key(&self, key: &str) -> Result<()>
Locks one row by key where the database supports row locks.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn upsert_prevalidated(
&self,
request: SystemConfigUpsert<'_>,
) -> Result<Model>
pub async fn upsert_prevalidated( &self, request: SystemConfigUpsert<'_>, ) -> Result<Model>
Persists a prevalidated storage string using registry metadata for known system keys.
§Preconditions
The caller must complete structure, normalizer, and dependency validation on the logical
value, then encode any secret envelope. request.value is written verbatim without those
checks; custom-key validation and authorization remain product-owned. This method uses the
owned connection and does not coordinate audit, snapshots, or notifications. Use
SystemConfigDbBinding::upsert_prevalidated with a transaction for atomic write/audit,
then update snapshots and notify after commit.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn delete_by_key(&self, key: &str) -> Result<()>
pub async fn delete_by_key(&self, key: &str) -> Result<()>
Sourcepub async fn ensure_system_value_if_missing(
&self,
key: &str,
value: &str,
) -> Result<bool>
pub async fn ensure_system_value_if_missing( &self, key: &str, value: &str, ) -> Result<bool>
Inserts one system value if no row exists.
The caller must validate the logical value and encode any secret before calling. value
is persisted verbatim without structure, normalizer, or dependency validation.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn delete_deprecated_keys(&self) -> Result<u64>
pub async fn delete_deprecated_keys(&self) -> Result<u64>
Deletes deprecated system keys configured by the product.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn ensure_defaults(&self) -> Result<usize>
pub async fn ensure_defaults(&self) -> Result<usize>
Ensures default rows exist and repairs metadata for existing system rows.
§Errors
Returns an error when the database operation fails.
Trait Implementations§
Source§impl Clone for SystemConfigDbStore
impl Clone for SystemConfigDbStore
Source§fn clone(&self) -> SystemConfigDbStore
fn clone(&self) -> SystemConfigDbStore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SystemConfigDbStore
impl !RefUnwindSafe for SystemConfigDbStore
impl Send for SystemConfigDbStore
impl Sync for SystemConfigDbStore
impl Unpin for SystemConfigDbStore
impl UnsafeUnpin for SystemConfigDbStore
impl !UnwindSafe for SystemConfigDbStore
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 more