aboutsummaryrefslogtreecommitdiff
path: root/appservice/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'appservice/db.go')
-rw-r--r--appservice/db.go21
1 files changed, 21 insertions, 0 deletions
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
+}