Fixed lint
This commit is contained in:
parent
9e6ddafe7e
commit
28b5231199
|
@ -8,12 +8,12 @@ import (
|
||||||
// ConfigStruct holds the config struct
|
// ConfigStruct holds the config struct
|
||||||
type ConfigStruct struct {
|
type ConfigStruct struct {
|
||||||
Database struct {
|
Database struct {
|
||||||
Type string
|
Type string
|
||||||
Host string
|
Host string
|
||||||
User string
|
User string
|
||||||
Password string
|
Password string
|
||||||
Database string
|
Database string
|
||||||
Path string
|
Path string
|
||||||
ShowQueries bool
|
ShowQueries bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
_ "github.com/mattn/go-sqlite3" // Because.
|
|
||||||
_ "github.com/go-sql-driver/mysql" // Because.
|
_ "github.com/go-sql-driver/mysql" // Because.
|
||||||
"github.com/go-xorm/core"
|
"github.com/go-xorm/core"
|
||||||
"github.com/go-xorm/xorm"
|
"github.com/go-xorm/xorm"
|
||||||
|
_ "github.com/mattn/go-sqlite3" // Because.
|
||||||
)
|
)
|
||||||
|
|
||||||
var x *xorm.Engine
|
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",
|
connStr := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8&parseTime=true",
|
||||||
Config.Database.User, Config.Database.Password, Config.Database.Host, Config.Database.Database)
|
Config.Database.User, Config.Database.Password, Config.Database.Host, Config.Database.Database)
|
||||||
return xorm.NewEngine("mysql", connStr)
|
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
|
// SetEngine sets the xorm.Engine
|
||||||
|
|
Loading…
Reference in New Issue