pub struct SystemConfigDbBinding { /* private fields */ }Expand description
Product binding for the shared system config store.
A product normally has one static binding that supplies its registry and deprecated-key list.
Repository code can then focus on product error mapping, authorization, and API cursor shape
instead of repeatedly passing the same registry values into every call.
Binding a registry does not make writes validated; see Self::upsert_prevalidated.
Implementations§
Source§impl SystemConfigDbBinding
impl SystemConfigDbBinding
Sourcepub const fn new(
registry: &'static ConfigRegistry,
deprecated_keys: &'static [&'static str],
) -> Self
pub const fn new( registry: &'static ConfigRegistry, deprecated_keys: &'static [&'static str], ) -> Self
Creates a product binding from a config registry and deprecated key list.
Sourcepub async fn find_cursor<C: ConnectionTrait>(
&self,
db: &C,
limit: u64,
after_id: Option<i64>,
) -> Result<SystemConfigCursorSlice>
pub async fn find_cursor<C: ConnectionTrait>( &self, db: &C, 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_by_key<C: ConnectionTrait>(
&self,
db: &C,
key: &str,
) -> Result<Option<Model>>
pub async fn find_by_key<C: ConnectionTrait>( &self, db: &C, key: &str, ) -> Result<Option<Model>>
Sourcepub async fn find_visible_custom<C: ConnectionTrait>(
&self,
db: &C,
include_authenticated: bool,
) -> Result<Vec<Model>>
pub async fn find_visible_custom<C: ConnectionTrait>( &self, db: &C, 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<C: ConnectionTrait>(
&self,
db: &C,
key: &str,
) -> Result<()>
pub async fn lock_by_key<C: ConnectionTrait>( &self, db: &C, 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<C: ConnectionTrait>(
&self,
db: &C,
request: SystemConfigUpsert<'_>,
) -> Result<Model>
pub async fn upsert_prevalidated<C: ConnectionTrait>( &self, db: &C, 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 before constructing the request, then encode any secret storage envelope. This
method writes request.value verbatim without any of those checks. Custom-key validation,
authorization, and audit remain product-owned. Pass a transaction for atomic write/audit;
update snapshots and notify only after commit. See upsert_prevalidated.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn ensure_system_value_if_missing<C: ConnectionTrait>(
&self,
db: &C,
key: &str,
value: &str,
) -> Result<bool>
pub async fn ensure_system_value_if_missing<C: ConnectionTrait>( &self, db: &C, 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.
Trait Implementations§
Source§impl Clone for SystemConfigDbBinding
impl Clone for SystemConfigDbBinding
Source§fn clone(&self) -> SystemConfigDbBinding
fn clone(&self) -> SystemConfigDbBinding
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SystemConfigDbBinding
Auto Trait Implementations§
impl Freeze for SystemConfigDbBinding
impl RefUnwindSafe for SystemConfigDbBinding
impl Send for SystemConfigDbBinding
impl Sync for SystemConfigDbBinding
impl Unpin for SystemConfigDbBinding
impl UnsafeUnpin for SystemConfigDbBinding
impl UnwindSafe for SystemConfigDbBinding
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