add model
This commit is contained in:
@@ -11,17 +11,9 @@ import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Token string `yaml:"token"`
|
||||
UserName string `yaml:"user_name"`
|
||||
Password string `yaml:"password"`
|
||||
HostName string `yaml:"host_name"`
|
||||
DbName string `yaml:"db_name"`
|
||||
}
|
||||
|
||||
type DataController struct{ DB *sql.DB }
|
||||
|
||||
func NewDB(config Config) *DataController {
|
||||
func NewDB(config models.Config) *DataController {
|
||||
dbaddr := fmt.Sprintf("%s:%s@tcp(%s)/%s", config.UserName, config.Password, config.HostName, config.DbName)
|
||||
|
||||
db, err := sql.Open("mysql", dbaddr)
|
||||
|
||||
Reference in New Issue
Block a user