增加抽取字段列表

This commit is contained in:
白茶清欢 2024-06-30 18:55:35 +08:00
parent 87cf49d160
commit c54b04d727

View File

@ -50,7 +50,7 @@ type client struct {
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 19:19 2022/6/5 // Date : 19:19 2022/6/5
func (c *client) AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger) error { func (c *client) AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger, extraFieldList []string) error {
var ( var (
err error err error
cfg *cfgFile cfg *cfgFile
@ -63,7 +63,7 @@ func (c *client) AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger)
// 不支持的配置文件格式 // 不支持的配置文件格式
return nil return nil
} }
return c.AddWithConfig(cfg.Flag, logInstance, cfg.Config) return c.AddWithConfig(cfg.Flag, logInstance, cfg.Config, extraFieldList)
} }
// AddWithConfig ... // AddWithConfig ...
@ -71,13 +71,13 @@ func (c *client) AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger)
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 20:41 2023/4/18 // Date : 20:41 2023/4/18
func (c *client) AddWithConfig(flag string, logInstance *zap.Logger, databaseConfig *Database) error { func (c *client) AddWithConfig(flag string, logInstance *zap.Logger, databaseConfig *Database, extraFieldList []string) error {
dbClient := &DBClient{ dbClient := &DBClient{
dbFlag: flag, dbFlag: flag,
loggerInstance: logInstance, loggerInstance: logInstance,
master: nil, master: nil,
slave: nil, slave: nil,
extraFieldList: nil, extraFieldList: extraFieldList,
cfg: Driver{}, cfg: Driver{},
} }
var err error var err error
@ -98,10 +98,10 @@ func (c *client) AddWithConfig(flag string, logInstance *zap.Logger, databaseCon
// Author : go_developer@163.com<白茶清欢> // Author : go_developer@163.com<白茶清欢>
// //
// Date : 19:19 2022/6/5 // Date : 19:19 2022/6/5
func (c *client) BatchAddWithConfigDir(cfgDir string, logInstance *zap.Logger) error { func (c *client) BatchAddWithConfigDir(cfgDir string, logInstance *zap.Logger, extraFieldList []string) error {
filepathNames, _ := filepath.Glob(filepath.Join(cfgDir, "*")) filepathNames, _ := filepath.Glob(filepath.Join(cfgDir, "*"))
for i := range filepathNames { for i := range filepathNames {
if err := c.AddWithConfigFile(filepathNames[i], logInstance); nil != err { if err := c.AddWithConfigFile(filepathNames[i], logInstance, extraFieldList); nil != err {
return err return err
} }
} }