From c54b04d72779fb0558e345d9e47b9d4ae9189424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sun, 30 Jun 2024 18:55:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8A=BD=E5=8F=96=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 7a8c596..1bcf5dd 100644 --- a/client.go +++ b/client.go @@ -50,7 +50,7 @@ type client struct { // Author : go_developer@163.com<白茶清欢> // // 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 ( err error cfg *cfgFile @@ -63,7 +63,7 @@ func (c *client) AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger) // 不支持的配置文件格式 return nil } - return c.AddWithConfig(cfg.Flag, logInstance, cfg.Config) + return c.AddWithConfig(cfg.Flag, logInstance, cfg.Config, extraFieldList) } // AddWithConfig ... @@ -71,13 +71,13 @@ func (c *client) AddWithConfigFile(cfgFilePath string, logInstance *zap.Logger) // Author : go_developer@163.com<白茶清欢> // // 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{ dbFlag: flag, loggerInstance: logInstance, master: nil, slave: nil, - extraFieldList: nil, + extraFieldList: extraFieldList, cfg: Driver{}, } var err error @@ -98,10 +98,10 @@ func (c *client) AddWithConfig(flag string, logInstance *zap.Logger, databaseCon // Author : go_developer@163.com<白茶清欢> // // 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, "*")) 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 } }