aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2018-06-12 14:58:02 -0700
committerAdam Mathes <adam@trenchant.org>2018-06-12 14:58:02 -0700
commit9e011074bcc80e00e6deb5b914371718e5991ce2 (patch)
treef8e7ef28d53f271354b369a3f5ef0844cd8a7ee6 /models
parent968d44abeb1fc378d4ce8e207c9f4983c19eb47a (diff)
downloadneko-9e011074bcc80e00e6deb5b914371718e5991ce2.tar.gz
neko-9e011074bcc80e00e6deb5b914371718e5991ce2.tar.bz2
neko-9e011074bcc80e00e6deb5b914371718e5991ce2.zip
sqlite3 support
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)
+ }
}