You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
492 B

package config
import (
"fmt"
"github.com/zeromicro/go-zero/zrpc"
)
// MySQL 数据库配置
type MySQLConf struct {
Host string
Port int
User string
Password string
DBName string
MaxIdleConns int
MaxOpenConns int
}
func (m MySQLConf) DSN() string {
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local",
m.User, m.Password, m.Host, m.Port, m.DBName)
}
type Config struct {
zrpc.RpcServerConf
MySQL MySQLConf
}