Fixed lint

This commit is contained in:
kolaente 2017-12-05 12:01:31 +01:00
parent 9e6ddafe7e
commit 28b5231199
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 10 additions and 10 deletions

View File

@ -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
}

View File

@ -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