summaryrefslogblamecommitdiff
path: root/src/db.rs
blob: 3d50b0f73472b045ed55582c2cf0a86e6357d205 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                                                                                                                 
use crate::Modloader;

pub fn insert_mod(id: String, name: String, current_version: String, old_versions: Vec<String>, mod_loader: Modloader, desired_mc_version: String) -> Result<(), sqlite::Error> {

    let connection = sqlite::open("./data.db").unwrap();

    let loader = match mod_loader {
        Modloader::Fabric => "fabric",
        Modloader::Forge => "forge",
    };
    
    let sql = format!("INSERT INTO mods VALUES ('{}', '{}', '{}', '{}', '{}', '{}')", id, name, current_version, old_versions.join("|"), loader, desired_mc_version);
    
    dbg!(&sql);

    connection.execute(sql)

}