mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
improve gdb for configiration
This commit is contained in:
parent
8f1fd259d4
commit
acd5e72f6c
@ -64,15 +64,15 @@ func SetConfig(config Config) {
|
||||
configs.config = config
|
||||
}
|
||||
|
||||
// 添加数据库服务器集群配置
|
||||
func AddConfigGroup(group string, nodes ConfigGroup) {
|
||||
// 按照配置分组设置数据库服务器集群配置
|
||||
func SetConfigGroup(group string, nodes ConfigGroup) {
|
||||
defer instances.Clear()
|
||||
configs.Lock()
|
||||
defer configs.Unlock()
|
||||
configs.config[group] = nodes
|
||||
}
|
||||
|
||||
// 添加一台数据库服务器配置
|
||||
// 按照配置分组添加一台数据库服务器配置
|
||||
func AddConfigNode(group string, node ConfigNode) {
|
||||
defer instances.Clear()
|
||||
configs.Lock()
|
||||
@ -87,7 +87,7 @@ func AddDefaultConfigNode(node ConfigNode) {
|
||||
|
||||
// 添加默认链接的数据库服务器集群配置
|
||||
func AddDefaultConfigGroup(nodes ConfigGroup) {
|
||||
AddConfigGroup(DEFAULT_GROUP_NAME, nodes)
|
||||
SetConfigGroup(DEFAULT_GROUP_NAME, nodes)
|
||||
}
|
||||
|
||||
// 添加一台数据库服务器配置
|
||||
|
@ -124,7 +124,7 @@ func Database(name ...string) gdb.DB {
|
||||
}
|
||||
}
|
||||
if len(cg) > 0 {
|
||||
gdb.AddConfigGroup(group, cg)
|
||||
gdb.SetConfigGroup(group, cg)
|
||||
}
|
||||
}
|
||||
// Parse <m> as a single node configuration.
|
||||
@ -134,7 +134,7 @@ func Database(name ...string) gdb.DB {
|
||||
cg = append(cg, *node)
|
||||
}
|
||||
if len(cg) > 0 {
|
||||
gdb.AddConfigGroup(group, cg)
|
||||
gdb.SetConfigGroup(group, cg)
|
||||
}
|
||||
}
|
||||
addConfigMonitor(instanceKey, config)
|
||||
|
Loading…
Reference in New Issue
Block a user