1 Star 0 Fork 0

最爱腿腿 / goimooc_common

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mysql.go 622 Bytes
一键复制 编辑 原始数据 按行查看 历史
最爱腿腿 提交于 2024-04-29 14:50 . 1
package common
import "go-micro.dev/v4/config"
type MysqlConfig struct {
Host string `json:"host"`
User string `json:"user"`
Pwd string `json:"pwd"`
Database string `json:"database"`
Port int64 `json:"port"`
}
// GetMysqlFromConsul 获取 mysql 的配置
func GetMysqlFromConsul(config config.Config, path ...string) *MysqlConfig {
mysqlConfig := &MysqlConfig{}
config.Get(path...).Scan(mysqlConfig)
return mysqlConfig
}
func GetMysqlFromConsulV2(config config.Config, path ...string) *MysqlConfig {
mysqlConfig := &MysqlConfig{}
config.Get(path...).Scan(mysqlConfig)
return mysqlConfig
}
Go
1
https://gitee.com/fushi/goimooc_common.git
git@gitee.com:fushi/goimooc_common.git
fushi
goimooc_common
goimooc_common
8c6f2f55334a

搜索帮助