Skip to main content

upsert_prevalidated

Function upsert_prevalidated 

Source
pub async fn upsert_prevalidated<C: ConnectionTrait>(
    db: &C,
    registry: &'static ConfigRegistry,
    request: SystemConfigUpsert<'_>,
) -> Result<Model>
Expand description

Persists a prevalidated storage string using registry metadata for known system keys.

§Preconditions

Validate the logical value with [ConfigRegistry::normalize_value] or [ConfigRegistry::value_to_storage_for_key] before calling, then perform any product-owned secret encoding. request.value is written verbatim, including encoded envelopes: this method performs no structure validation, normalizer, or dependency validation. The registry selects metadata for inserts, not validation policy. Custom-key validation, permissions, and audit remain product-owned.

Pass a transaction as db to combine the write with product audit. This function neither commits that transaction nor updates snapshots or publishes reload notifications. Perform those runtime side effects only after a successful commit.

§Errors

Returns an error when the database operation fails.