You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: util.rs
    path of file: ./repos/plane/plane/src/database
    
    the code of the file until where you have to start completion: /// Unique violation error code in Postgres.
/// From: https://www.postgresql.org/docs/9.2/errcodes-appendix.html
pub const PG_UNIQUE_VIOLATION_ERROR: &str = "23505";
pub const PG_FOREIGN_KEY_VIOLATION_ERROR: &str = "23503";
    
pub fn unique_violation_to_option<T>(result: sqlx::Result<T>) -> sqlx::Result<Option<T>> {
    match result {
        Ok(result) => Ok(Some(result)),
        Err(sqlx::Error::Database(db_error)) => {
            if db_error
                .code()
                .map(|d| d == PG_UNIQUE_VIOLATION_ERROR)
                .unwrap_or_default()
            {
                Ok(None)
            } else {
                Err(sqlx::Error::Database(db_error))
            }
        }
        Err(other) => Err(other),
    }
}