Documentation
¶
Index ¶
- func DeclarePflagsByStruct(structVar interface{})
- func FileExists(filename string) error
- func FindRegexGroup1(str, regexStr string) ([]string, error)
- func ReplaceFileContent(filename, regexStr, repl string) error
- func ReplaceRegexGroup1(str, regexStr, repl string) (string, error)
- func SearchPatternLines(str, boundaryRegexStr, captureGroup1Regex string) ([]string, error)
- func SearchPatternLinesInFile(filename, boundaryRegexStr, captureGroup1Regex string) ([]string, error)
- func ViperToStruct(structVar interface{})
- type Result
- type Settings
- type SettingsOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeclarePflagsByStruct ¶
func DeclarePflagsByStruct(structVar interface{})
DeclarePflagsByStruct declares flags from struct fields'name and type
func FindRegexGroup1 ¶
FindRegexGroup1 使用正则表达式regexStr在str中查找内容
func ReplaceFileContent ¶
ReplaceFileContent 使用正则表达式查找模式,并且替换正则1号捕获分组为指定的内容
func ReplaceRegexGroup1 ¶
ReplaceRegexGroup1 使用正则表达式regexStr在str中查找内容,并且替换正则1号捕获分组为指定的内容
func SearchPatternLines ¶
SearchPatternLines 使用正则表达式boundaryRegexStr在str中查找大块,然后在大块中用captureGroup1Regex中的每行寻找匹配
func SearchPatternLinesInFile ¶
func SearchPatternLinesInFile(filename, boundaryRegexStr, captureGroup1Regex string) ([]string, error)
SearchPatternLinesInFile 使用正则表达式boundaryRegexStr查找大块,然后在大块中用captureGroup1Regex中的每行寻找匹配
func ViperToStruct ¶
func ViperToStruct(structVar interface{})
ViperToStruct read viper value to struct
Types ¶
type Settings ¶
type Settings struct {
ListenName string `validate:"empty=false"` // HAProxy配置文件中listen名称
Port int `validate:"gte=0"` // HAProxy前端端口号
BackAddrs []string `validate:"empty=false"` // 后端地址
HAProxyCfg string `default:"/etc/haproxy.cfg"` // HAProxy配置文件地址
HAProxyRestartShell string `default:"systemctl restart haproxy"` // HAProxy重启命令
Debug bool // 测试模式,只打印HAProxy配置, 不实际执行
}
Settings 表示初始化化MySQL集群所需要的参数结构
func (Settings) CheckHAProxyServers ¶
func (s Settings) CheckHAProxyServers()
CheckHAProxyServers 检查
func (Settings) GetAnchorEnd ¶
func (Settings) GetAnchorStart ¶
func (*Settings) ValidateAndSetDefault ¶
func (s *Settings) ValidateAndSetDefault(options ...SettingsOption) error
Click to show internal directories.
Click to hide internal directories.