From b03cf48eb2074ef41ced9d59712b005a127c17bf Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Tue, 26 Jul 2022 01:08:03 +0200 Subject: feat: Add necessary param for packing Datadir parameter will make easier for later to create the apk. --- db/db.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'db') diff --git a/db/db.go b/db/db.go index 948f154..4728aa7 100644 --- a/db/db.go +++ b/db/db.go @@ -1,6 +1,8 @@ package db import ( + "path" + "gorm.io/driver/sqlite" "gorm.io/gorm" ) @@ -10,8 +12,10 @@ var ( err error ) -func ConnectDb() { - DB, err = gorm.Open(sqlite.Open("main.db"), &gorm.Config{}) +func ConnectDb(folder string) { + dbPath := path.Join(folder, "main.db") + + DB, err = gorm.Open(sqlite.Open(dbPath), &gorm.Config{}) if err != nil { panic("failed to connect to the database.") -- cgit v1.2.3