forked from hwholiday/learning_tools
/
mysql.go
43 lines (40 loc) · 857 Bytes
/
mysql.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
package config
type sqlConfig interface {
GetIp() string
GetPort() string
GetName() string
GetPass() string
GetDb() string
GetMaxIdle() int
GetMaxOpen() int
}
type defaultMysqlConfig struct {
Ip string `ini:"ip"`
Port string `ini:"port"`
Name string `ini:"name"`
Pass string `ini:"pass"`
Db string `ini:"db"`
MaxIdle int `ini:"max_idle"`
MaxOpen int `ini:"max_open"`
}
func (m defaultMysqlConfig) GetIp() string {
return m.Ip
}
func (m defaultMysqlConfig) GetPort() string {
return m.Port
}
func (m defaultMysqlConfig) GetName() string {
return m.Name
}
func (m defaultMysqlConfig) GetPass() string {
return m.Pass
}
func (m defaultMysqlConfig) GetDb() string {
return m.Db
}
func (m defaultMysqlConfig) GetMaxIdle() int {
return m.MaxIdle
}
func (m defaultMysqlConfig) GetMaxOpen() int {
return m.MaxOpen
}