aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/db.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/models/db.go b/models/db.go
index b8bc655..31d8bdd 100644
--- a/models/db.go
+++ b/models/db.go
@@ -4,21 +4,24 @@ Package neko/models implements behavior for the entities necessary for the subsc
package models
import (
- "database/sql"
+ "adammathes.com/neko/config"
+ "database/sql"
_ "github.com/go-sql-driver/mysql"
- "log"
+ _ "github.com/mattn/go-sqlite3"
+ "log"
)
var DB *sql.DB
-func InitDB(dataSourceName string) {
- var err error
- DB, err = sql.Open("mysql", dataSourceName)
- if err != nil {
- log.Panic(err)
- }
+func InitDB() {
+ var err error
+ // DB, err = sql.Open("mysql", dataSourceName)
+ DB, err = sql.Open(config.Config.DBDriver, config.Config.DBServer)
+ if err != nil {
+ log.Panic(err)
+ }
- if err = DB.Ping(); err != nil {
- log.Panic(err)
- }
+ if err = DB.Ping(); err != nil {
+ log.Panic(err)
+ }
}