Files
EdgeAPI/internal/db/models/db_node_model_ext.go

19 lines
378 B
Go
Raw Normal View History

2020-09-23 10:12:57 +08:00
package models
2021-01-19 12:05:35 +08:00
import (
"fmt"
2024-07-27 14:15:25 +08:00
2021-01-19 12:05:35 +08:00
"github.com/iwind/TeaGo/dbs"
)
// 获取数据库配置
func (this *DBNode) DBConfig() *dbs.DBConfig {
dsn := this.Username + ":" + this.Password + "@tcp(" + this.Host + ":" + fmt.Sprintf("%d", this.Port) + ")/" + this.Database + "?charset=utf8mb4&timeout=10s"
return &dbs.DBConfig{
Driver: "mysql",
Dsn: dsn,
Prefix: "edge",
}
}