summaryrefslogtreecommitdiff
path: root/src/db.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db.rs')
-rw-r--r--src/db.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/db.rs b/src/db.rs
index e69de29..3d50b0f 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -0,0 +1,18 @@
1use crate::Modloader;
2
3pub fn insert_mod(id: String, name: String, current_version: String, old_versions: Vec<String>, mod_loader: Modloader, desired_mc_version: String) -> Result<(), sqlite::Error> {
4
5 let connection = sqlite::open("./data.db").unwrap();
6
7 let loader = match mod_loader {
8 Modloader::Fabric => "fabric",
9 Modloader::Forge => "forge",
10 };
11
12 let sql = format!("INSERT INTO mods VALUES ('{}', '{}', '{}', '{}', '{}', '{}')", id, name, current_version, old_versions.join("|"), loader, desired_mc_version);
13
14 dbg!(&sql);
15
16 connection.execute(sql)
17
18}