From 046ec6380b7bb363e537ade7fd254b5505dde32d Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 16 Feb 2020 19:30:49 +0100 Subject: Some infrastructure --- appservice/db.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 appservice/db.go (limited to 'appservice/db.go') diff --git a/appservice/db.go b/appservice/db.go new file mode 100644 index 0000000..2c71312 --- /dev/null +++ b/appservice/db.go @@ -0,0 +1,21 @@ +package appservice + +import ( + "github.com/jinzhu/gorm" + _ "github.com/jinzhu/gorm/dialects/mysql" + _ "github.com/jinzhu/gorm/dialects/postgres" + _ "github.com/jinzhu/gorm/dialects/sqlite" +) + +var db *gorm.DB + +func InitDb() error { + var err error + + db, err = gorm.Open(config.DbType, config.DbPath) + if err != nil { + return err + } + + return nil +} -- cgit v1.2.3