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.
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_all<C: ConnectionTrait>(&self, db: &C) -> Result<Vec<Model>>
pub async fn find_all<C: ConnectionTrait>(&self, db: &C) -> Result<Vec<Model>>
Lists all rows by stable id order.
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.
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>>
Finds one row by key.
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.
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.
Sourcepub async fn upsert<C: ConnectionTrait>(
&self,
db: &C,
request: SystemConfigUpsert<'_>,
) -> Result<Model>
pub async fn upsert<C: ConnectionTrait>( &self, db: &C, request: SystemConfigUpsert<'_>, ) -> Result<Model>
Upserts one row using this binding’s registry metadata for known system keys.
Sourcepub async fn delete_by_key<C: ConnectionTrait>(
&self,
db: &C,
key: &str,
) -> Result<()>
pub async fn delete_by_key<C: ConnectionTrait>( &self, db: &C, key: &str, ) -> Result<()>
Deletes a custom row.
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.
Sourcepub async fn delete_deprecated_keys<C: ConnectionTrait>(
&self,
db: &C,
) -> Result<u64>
pub async fn delete_deprecated_keys<C: ConnectionTrait>( &self, db: &C, ) -> Result<u64>
Deletes deprecated system keys configured by the product.
Sourcepub async fn ensure_defaults<C: ConnectionTrait>(&self, db: &C) -> Result<usize>
pub async fn ensure_defaults<C: ConnectionTrait>(&self, db: &C) -> Result<usize>
Ensures default rows exist and repairs metadata for existing system rows.
Trait Implementations§
Source§impl Clone for SystemConfigDbBinding
impl Clone for SystemConfigDbBinding
Source§fn clone(&self) -> SystemConfigDbBinding
fn clone(&self) -> SystemConfigDbBinding
1.0.0 (const: unstable) · 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