summaryrefslogtreecommitdiff
path: root/src/db.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2022-10-31 22:41:18 +0100
committerfxqnlr <[email protected]>2022-10-31 22:41:18 +0100
commitfc1cb1acc0dce412e948475002666bcd1d4b0348 (patch)
tree6b7667b453af8f2065681fa4dd850b0675b7bbde /src/db.rs
parent3320da719669f37dd5f55693b4d76edb27dbce02 (diff)
downloadmodlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.tar
modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.tar.gz
modlist-fc1cb1acc0dce412e948475002666bcd1d4b0348.zip
add first impl
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}