数据库批量初始化

This commit is contained in:
白茶清欢 2022-06-11 19:18:42 +08:00
parent cdf075a576
commit 8ee691e938
1 changed files with 8 additions and 1 deletions

View File

@ -90,6 +90,12 @@ func (c *client) AddWithConfigFile(cfgFilePath string) error {
//
// Date : 19:19 2022/6/5
func (c *client) BatchAddWithConfigDir(cfgDir string) error {
filepathNames, _ := filepath.Glob(filepath.Join(cfgDir, "*"))
for i := range filepathNames {
if err := c.AddWithConfigFile(filepathNames[i]); nil != err {
return err
}
}
return nil
}
@ -98,8 +104,9 @@ func (c *client) BatchAddWithConfigDir(cfgDir string) error {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 14:39 2022/6/9
func (c *client) getMysqlCfgFileList(cfgDir string) ([]*cfgFile, error) {
func (c *client) getMysqlCfgFileList(cfgDir string) ([]string, error) {
filepathNames, _ := filepath.Glob(filepath.Join(cfgDir, "*"))
cfgFileList := make([]*cfgFile, 0)
for i := range filepathNames {
var (