Skip to main content

set_config

Function set_config 

Source
pub async fn set_config(
    field: &str,
    contents: ConfigOption,
) -> Result<(), ConfigError>
Expand description

Stores a ConfigOption in the database.

This function inserts or updates a configuration option into the appropriate table (either config or configdata depending on the variant).

§Arguments

  • field: The name of the field to store.
  • contents: The ConfigOption to store, which can be either a string or a binary blob.

§Example

set_config("language", ConfigOption::String("en".to_string())).await?;

§Errors

Returns ConfigError::DB if there is an issue with the database connection.