cluster.go 695 字节
Newer Older
E
eoLinker API Management 已提交
1 2
package entity

Y
Your Name 已提交
3 4 5
import (
	"fmt"
)
Y
Your Name 已提交
6

Y
Your Name 已提交
7
//ClusterDB 集群DB配置
E
eoLinker API Management 已提交
8 9 10 11 12 13 14
type ClusterDB struct {
	Driver   string `json:"driver" yaml:"driver"`
	Host     string `json:"host" yaml:"host"`
	Port     int    `json:"port" yaml:"port"`
	UserName string `json:"userName" yaml:"userName"`
	Password string `json:"password" yaml:"password"`
	Database string `json:"database" yaml:"database"`
Y
Your Name 已提交
15
	Path     string `json:"path" yaml:"path"`
E
eoLinker API Management 已提交
16
}
Y
Your Name 已提交
17

Y
Your Name 已提交
18
//GetDriver 获取驱动名称
E
eoLinker API Management 已提交
19 20 21 22
func (c *ClusterDB) GetDriver() string {
	return c.Driver
}

Y
Your Name 已提交
23
//GetSource 获取连接字符串
E
eoLinker API Management 已提交
24 25 26
func (c *ClusterDB) GetSource() string {
	return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8", c.UserName, c.Password, c.Host, c.Port, c.Database)
}