aboutsummaryrefslogtreecommitdiff
path: root/src/db/event_color.rs
blob: 33d350b7869c86cc2c17659035ebffae17113add (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use anyhow::Result;
use rusqlite::Connection;

pub fn get_default_color(conn: &Connection) -> Result<String> {
    let mut stmt = conn.prepare("SELECT * FROM event_color LIMIT 1")?;

    let iter = stmt.query_map([], |row| row.get(0))?;

    let mut res = vec![];
    for color in iter {
        res.push(color?)
    }
    Ok(res.first().unwrap_or(&"blue".to_string()).clone())
}