diff --git a/models/config.go b/models/config.go index 5d65cd1..dba67f3 100644 --- a/models/config.go +++ b/models/config.go @@ -8,12 +8,12 @@ import ( // ConfigStruct holds the config struct type ConfigStruct struct { Database struct { - Type string + Type string Host string User string Password string Database string - Path string + Path string ShowQueries bool } diff --git a/models/models.go b/models/models.go index 6a16e6b..3657f0e 100644 --- a/models/models.go +++ b/models/models.go @@ -2,10 +2,10 @@ package models import ( "fmt" - _ "github.com/mattn/go-sqlite3" // Because. _ "github.com/go-sql-driver/mysql" // Because. "github.com/go-xorm/core" "github.com/go-xorm/xorm" + _ "github.com/mattn/go-sqlite3" // Because. ) var x *xorm.Engine @@ -16,14 +16,14 @@ func getEngine() (*xorm.Engine, error) { connStr := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=true", Config.Database.User, Config.Database.Password, Config.Database.Host, Config.Database.Database) return xorm.NewEngine("mysql", connStr) - } else { - // Otherwise use sqlite - path := Config.Database.Path - if path == "" { - path = "./db.db" - } - return xorm.NewEngine("sqlite3", path) } + + // Otherwise use sqlite + path := Config.Database.Path + if path == "" { + path = "./db.db" + } + return xorm.NewEngine("sqlite3", path) } // SetEngine sets the xorm.Engine