forked from hdget/hdsdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configer.go
82 lines (64 loc) · 1.42 KB
/
configer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package hdsdk
import (
"github.com/hdget/hdsdk/types"
)
type Config struct {
Sdk *types.SdkConfigItem `mapstructure:"sdk"`
}
var _ types.Configer = (*Config)(nil)
// GetMysqlConfig 获取数据库配置
func (c *Config) GetMysqlConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.Mysql
}
// GetRedisConfig 获取缓存配置
func (c *Config) GetRedisConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.Redis
}
// GetLogConfig 获取日志配置
func (c *Config) GetLogConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.Log
}
// GetRabbitmqConfig 获取消息队列配置
func (c *Config) GetRabbitmqConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.RabbitMq
}
// GetKafkaConfig 获取Kafka消息队列配置
func (c *Config) GetKafkaConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.Kafka
}
// GetMicroServiceConfig 获取Gokit微服务配置
func (c *Config) GetMicroServiceConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.MicroService
}
// GetNosqlConfig 获取非SQL配置
func (c *Config) GetNosqlConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.Kv
}
// GetKvConfig 获取KV配置
func (c *Config) GetKvConfig() interface{} {
if c == nil || c.Sdk == nil {
return nil
}
return c.Sdk.Kv
}