Repository: libsql/libsql
File: libsql-server/src/connection/config.rs (Rust)

Code before:
            jwt_key: value.jwt_key.clone(),
            txn_timeout_s: value.txn_timeout.map(|d| d.as_secs()),
            allow_attach: value.allow_attach,
            max_row_size: Some(value.max_row_size),
            shared_schema: Some(value.is_shared_schema),
            shared_schema_name: value.shared_schema_name.as_ref().map(|s| s.to_string()),
            durability_mode: Some(metadata::DurabilityMode::from(value.durability_mode).into()),
        }
    }
}

/// Durability mode specifies the `PRAGMA SYNCHRONOUS` setting for the connection
#[derive(PartialEq, Clone, Copy, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum DurabilityMode {
    Extra,
    Strong,
    Relaxed,
    Off,
}

impl Default for DurabilityMode {
    fn default() -> Self {
        DurabilityMode::Relaxed
    }
}

impl ToSql for DurabilityMode {
    fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
        match self {
            DurabilityMode::Extra => Ok(ToSqlOutput::from("extra")),
            DurabilityMode::Strong => Ok(ToSqlOutput::from("full")),
            DurabilityMode::Relaxed => Ok(ToSqlOutput::from("normal")),
            DurabilityMode::Off => Ok(ToSqlOutput::from("off")),
        }
    }
}

impl FromStr for DurabilityMode {
    type Err = ();

    fn from_str(input: &str) -> Result<DurabilityMode, Self::Err> {
        match input {
            "extra" => Ok(DurabilityMode::Extra),
            "strong" => Ok(DurabilityMode::Strong),
            "relaxed" => Ok(DurabilityMode::Relaxed),
            "off" => Ok(DurabilityMode::Off),
            _ => Err(()),
        }
    }
}

Review comment (bug):
nit:
```suggestion
#[derive(PartialEq, Clone, Copy, Debug, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum DurabilityMode {
    Extra,
    Strong,
    #[default]
    Relaxed,
    Off,
}
```

Code after:
            jwt_key: value.jwt_key.clone(),
            txn_timeout_s: value.txn_timeout.map(|d| d.as_secs()),
            allow_attach: value.allow_attach,
            max_row_size: Some(value.max_row_size),
            shared_schema: Some(value.is_shared_schema),
            shared_schema_name: value.shared_schema_name.as_ref().map(|s| s.to_string()),
            durability_mode: Some(metadata::DurabilityMode::from(value.durability_mode).into()),
        }
    }
}

/// Durability mode specifies the `PRAGMA SYNCHRONOUS` setting for the connection
#[derive(PartialEq, Clone, Copy, Debug, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum DurabilityMode {
    Extra,
    Strong,
    #[default]
    Relaxed,
    Off,
}

impl ToSql for DurabilityMode {
    fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
        match self {
            DurabilityMode::Extra => Ok(ToSqlOutput::from("extra")),
            DurabilityMode::Strong => Ok(ToSqlOutput::from("full")),
            DurabilityMode::Relaxed => Ok(ToSqlOutput::from("normal")),
            DurabilityMode::Off => Ok(ToSqlOutput::from("off")),
        }
    }
}

impl FromStr for DurabilityMode {
    type Err = ();

    fn from_str(input: &str) -> Result<DurabilityMode, Self::Err> {
        match input {
            "extra" => Ok(DurabilityMode::Extra),
            "strong" => Ok(DurabilityMode::Strong),
            "relaxed" => Ok(DurabilityMode::Relaxed),
            "off" => Ok(DurabilityMode::Off),
            _ => Err(()),
        }
    }
}

impl Display for DurabilityMode {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let m = match self {
            DurabilityMode::Extra => "extra",