From fc6dd8e130e8a3e5fee27d7df1532495bea863ae Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Fri, 25 Nov 2022 10:48:34 +0800 Subject: [PATCH 01/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=9A=82=E4=B8=8D=E4=BD=BF=E7=94=A8=E7=9A=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/search/query.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/search/query.go b/tools/search/query.go index ff56f1ac..a3a5af26 100644 --- a/tools/search/query.go +++ b/tools/search/query.go @@ -34,10 +34,10 @@ func ResolveSearchQuery(driver string, q interface{}, condition Condition) { var ok bool var t *resolveSearchTag - var sep = "`" - if driver == Postgres { - sep = "\"" - } + //var sep = "`" + //if driver == Postgres { + // sep = "\"" + //} for i := 0; i < qType.NumField(); i++ { tag, ok = "", false From cac45d4ef3db3c4271856d9570c05e32124e10e1 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 14:36:29 +0800 Subject: [PATCH 02/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7casbin=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/go.mod b/sdk/go.mod index 57e96de4..de530408 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/gin-gonic/gin v1.7.7 github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d - github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 + github.com/go-admin-team/gorm-adapter/v3 v3.7.8-0.20221127063444-bc66b935a0ab github.com/go-admin-team/redis-watcher/v2 v2.0.0-20221121052608-058cebff72c2 github.com/go-admin-team/redisqueue/v2 v2.0.0-20221119141731-97c556b0d5b7 github.com/go-playground/locales v0.13.0 @@ -105,6 +105,7 @@ require ( gorm.io/driver/postgres v1.4.5 // indirect gorm.io/driver/sqlite v1.4.3 // indirect gorm.io/driver/sqlserver v1.4.1 // indirect + gorm.io/plugin/dbresolver v1.3.0 // indirect ) //replace github.com/go-admin-team/go-admin-core => ../ From c3a2a639002f1f08ff03164243ae629720e50626 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 14:40:37 +0800 Subject: [PATCH 03/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9casbin=E6=95=B0=E6=8D=AE=E8=A1=A8sys=5Fcasbin=5Frule?= =?UTF-8?q?=E8=87=B3casbin=5Frule=20=E5=92=8Ccasbin=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/pkg/casbin/mycasbin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/pkg/casbin/mycasbin.go b/sdk/pkg/casbin/mycasbin.go index e4f5bf93..a04ed4a9 100644 --- a/sdk/pkg/casbin/mycasbin.go +++ b/sdk/pkg/casbin/mycasbin.go @@ -38,7 +38,7 @@ var ( func Setup(db *gorm.DB, _ string) *casbin.SyncedEnforcer { once.Do(func() { - Apter, err := gormAdapter.NewAdapterByDBUseTableName(db, "sys", "casbin_rule") + Apter, err := gormAdapter.NewAdapterByDBUseTableName(db, "", "casbin_rule") if err != nil && err.Error() != "invalid DDL" { panic(err) } From 6ebc08896fe5ca6f8e48bddeeec773fb46cc22d9 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 16:09:55 +0800 Subject: [PATCH 04/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0casbin=E6=8E=92=E9=99=A4=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 3 +- sdk/runtime/application.go | 60 ++++++++++++++++++++++++++++---------- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index de530408..a64d86f6 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -12,7 +12,7 @@ require ( github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d github.com/go-admin-team/gorm-adapter/v3 v3.7.8-0.20221127063444-bc66b935a0ab github.com/go-admin-team/redis-watcher/v2 v2.0.0-20221121052608-058cebff72c2 - github.com/go-admin-team/redisqueue/v2 v2.0.0-20221119141731-97c556b0d5b7 + github.com/go-admin-team/redisqueue/v2 v2.0.0 github.com/go-playground/locales v0.13.0 github.com/go-playground/universal-translator v0.17.0 github.com/go-playground/validator/v10 v10.4.1 @@ -44,7 +44,6 @@ require ( github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect - github.com/go-redis/redis/v8 v8.11.5 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index c8190308..0c301c54 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -14,21 +14,27 @@ import ( ) type Application struct { - dbs map[string]*gorm.DB - casbins map[string]*casbin.SyncedEnforcer - engine http.Handler - crontab map[string]*cron.Cron - mux sync.RWMutex - middlewares map[string]interface{} - cache storage.AdapterCache - queue storage.AdapterQueue - locker storage.AdapterLocker - memoryQueue storage.AdapterQueue - handler map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc) - routers []Router - configs map[string]interface{} // 系统参数 - appRouters []func() // app路由 - + dbs map[string]*gorm.DB + casbins map[string]*casbin.SyncedEnforcer + engine http.Handler + crontab map[string]*cron.Cron + mux sync.RWMutex + middlewares map[string]interface{} + cache storage.AdapterCache + queue storage.AdapterQueue + locker storage.AdapterLocker + memoryQueue storage.AdapterQueue + handler map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc) + routers []Router + configs map[string]interface{} // 系统参数 + appRouters []func() // app路由 + casbinExclude map[string]*[]UrlInfo // casbin排除 +} + +type UrlInfo struct { + Url string + Method string + Access string } type Router struct { @@ -39,6 +45,30 @@ type Routers struct { List []Router } +// SetCasbinExclude 设置对应key的Exclude +func (e *Application) SetCasbinExclude(key string, list *[]UrlInfo) { + e.mux.Lock() + defer e.mux.Unlock() + e.casbinExclude[key] = list +} + +// GetCasbinExclude 获取所有map里的Exclude数据 +func (e *Application) GetCasbinExclude() map[string]*[]UrlInfo { + e.mux.Lock() + defer e.mux.Unlock() + return e.casbinExclude +} + +// GetCasbinExcludeByKey 根据key获取Exclude +func (e *Application) GetCasbinExcludeByKey(key string) *[]UrlInfo { + e.mux.Lock() + defer e.mux.Unlock() + if exclude, ok := e.casbinExclude["*"]; ok { + return exclude + } + return e.casbinExclude[key] +} + // SetDb 设置对应key的db func (e *Application) SetDb(key string, db *gorm.DB) { e.mux.Lock() From 548da5ff3c3b59776fe5c16413e8f8b2b73e15da Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 16:12:45 +0800 Subject: [PATCH 05/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0casbin=E6=8E=92=E9=99=A4=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/type.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/runtime/type.go b/sdk/runtime/type.go index c44a9df0..dab94405 100644 --- a/sdk/runtime/type.go +++ b/sdk/runtime/type.go @@ -17,6 +17,10 @@ type Runtime interface { GetDb() map[string]*gorm.DB GetDbByKey(key string) *gorm.DB + SetCasbinExclude(key string, list *[]UrlInfo) + GetCasbinExclude() map[string]*[]UrlInfo + GetCasbinExcludeKey(key string) *[]UrlInfo + SetCasbin(key string, enforcer *casbin.SyncedEnforcer) GetCasbin() map[string]*casbin.SyncedEnforcer GetCasbinKey(key string) *casbin.SyncedEnforcer From cba89b776a79147ae59c63a77b4d2c5f04362d3e Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 16:37:49 +0800 Subject: [PATCH 06/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0casbin=E6=8E=92=E9=99=A4=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/application.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index 0c301c54..522616da 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -28,7 +28,7 @@ type Application struct { routers []Router configs map[string]interface{} // 系统参数 appRouters []func() // app路由 - casbinExclude map[string]*[]UrlInfo // casbin排除 + casbinExclude map[string]interface{} // casbin排除 } type UrlInfo struct { @@ -46,21 +46,21 @@ type Routers struct { } // SetCasbinExclude 设置对应key的Exclude -func (e *Application) SetCasbinExclude(key string, list *[]UrlInfo) { +func (e *Application) SetCasbinExclude(key string, list interface{}) { e.mux.Lock() defer e.mux.Unlock() e.casbinExclude[key] = list } // GetCasbinExclude 获取所有map里的Exclude数据 -func (e *Application) GetCasbinExclude() map[string]*[]UrlInfo { +func (e *Application) GetCasbinExclude() map[string]interface{} { e.mux.Lock() defer e.mux.Unlock() return e.casbinExclude } // GetCasbinExcludeByKey 根据key获取Exclude -func (e *Application) GetCasbinExcludeByKey(key string) *[]UrlInfo { +func (e *Application) GetCasbinExcludeByKey(key string) interface{} { e.mux.Lock() defer e.mux.Unlock() if exclude, ok := e.casbinExclude["*"]; ok { @@ -153,14 +153,15 @@ func (e *Application) GetLogger() logger.Logger { // NewConfig 默认值 func NewConfig() *Application { return &Application{ - dbs: make(map[string]*gorm.DB), - casbins: make(map[string]*casbin.SyncedEnforcer), - crontab: make(map[string]*cron.Cron), - middlewares: make(map[string]interface{}), - memoryQueue: queue.NewMemory(10000), - handler: make(map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)), - routers: make([]Router, 0), - configs: make(map[string]interface{}), + dbs: make(map[string]*gorm.DB), + casbins: make(map[string]*casbin.SyncedEnforcer), + crontab: make(map[string]*cron.Cron), + middlewares: make(map[string]interface{}), + memoryQueue: queue.NewMemory(10000), + handler: make(map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)), + routers: make([]Router, 0), + configs: make(map[string]interface{}), + casbinExclude: make(map[string]interface{}), } } From e3c14cbce86edb92bd7c58bfc7481d4bd02455c8 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 16:45:19 +0800 Subject: [PATCH 07/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0casbin=E6=8E=92=E9=99=A4=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/application.go | 6 ------ sdk/runtime/type.go | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index 522616da..09fc0466 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -31,12 +31,6 @@ type Application struct { casbinExclude map[string]interface{} // casbin排除 } -type UrlInfo struct { - Url string - Method string - Access string -} - type Router struct { HttpMethod, RelativePath, Handler string } diff --git a/sdk/runtime/type.go b/sdk/runtime/type.go index dab94405..d0f5eead 100644 --- a/sdk/runtime/type.go +++ b/sdk/runtime/type.go @@ -17,9 +17,9 @@ type Runtime interface { GetDb() map[string]*gorm.DB GetDbByKey(key string) *gorm.DB - SetCasbinExclude(key string, list *[]UrlInfo) - GetCasbinExclude() map[string]*[]UrlInfo - GetCasbinExcludeKey(key string) *[]UrlInfo + SetCasbinExclude(key string, list interface{}) + GetCasbinExclude() map[string]interface{} + GetCasbinExcludeKey(key string) interface{} SetCasbin(key string, enforcer *casbin.SyncedEnforcer) GetCasbin() map[string]*casbin.SyncedEnforcer From 27257842b6b9002fcfb01fcff90681d35428d864 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Nov 2022 16:47:45 +0800 Subject: [PATCH 08/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0casbin=E6=8E=92=E9=99=A4=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/type.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/runtime/type.go b/sdk/runtime/type.go index d0f5eead..6548c2ab 100644 --- a/sdk/runtime/type.go +++ b/sdk/runtime/type.go @@ -19,7 +19,7 @@ type Runtime interface { SetCasbinExclude(key string, list interface{}) GetCasbinExclude() map[string]interface{} - GetCasbinExcludeKey(key string) interface{} + GetCasbinExcludeByKey(key string) interface{} SetCasbin(key string, enforcer *casbin.SyncedEnforcer) GetCasbin() map[string]*casbin.SyncedEnforcer From 251a1b8138d61dfc7d6d5fa56fcaee6619d16b6d Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 1 Dec 2022 11:45:10 +0800 Subject: [PATCH 09/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4Application=E4=B8=AD=E7=9A=84JwtSecret=E6=97=A0?= =?UTF-8?q?=E6=95=88=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=AD=A4=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=8F=98=E6=9B=B4=E5=88=B0Jwt=E4=B8=8BSecret?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/config/application.go | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/config/application.go b/sdk/config/application.go index af1402e2..bccd85b5 100644 --- a/sdk/config/application.go +++ b/sdk/config/application.go @@ -6,7 +6,6 @@ type Application struct { Host string Port int64 Name string - JwtSecret string Mode string DemoMsg string EnableDP bool From 91c689428c8347b70353834c299d1e0e95ce08d7 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 1 Dec 2022 13:19:29 +0800 Subject: [PATCH 10/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=8C=87?= =?UTF-8?q?=E5=87=BA=E4=B8=8D=E7=AD=89=E4=BA=8E=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/search/query.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/search/query.go b/tools/search/query.go index a3a5af26..503768f2 100644 --- a/tools/search/query.go +++ b/tools/search/query.go @@ -74,6 +74,8 @@ func pgSql(driver string, t *resolveSearchTag, condition Condition, qValue refle ResolveSearchQuery(driver, qValue.Field(i).Interface(), join) case "exact", "iexact": condition.SetWhere(fmt.Sprintf("%s.%s = ?", t.Table, t.Column), []interface{}{qValue.Field(i).Interface()}) + case "glt": + condition.SetWhere(fmt.Sprintf("%s.%s <> ?", t.Table, t.Column), []interface{}{qValue.Field(i).Interface()}) case "icontains": condition.SetWhere(fmt.Sprintf("%s.%s ilike ?", t.Table, t.Column), []interface{}{"%" + qValue.Field(i).String() + "%"}) case "contains": From 4124c7ca30939140454ba2a7767242bdfd31024e Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Wed, 21 Dec 2022 20:54:58 +0800 Subject: [PATCH 11/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E7=A8=8B=E5=BA=8F=E5=90=AF=E5=8A=A8=E5=89=8D=E9=92=A9?= =?UTF-8?q?=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/application.go | 9 +++++++++ sdk/runtime/type.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index 09fc0466..44837830 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -29,6 +29,7 @@ type Application struct { configs map[string]interface{} // 系统参数 appRouters []func() // app路由 casbinExclude map[string]interface{} // casbin排除 + before []func() // 启动前执行 } type Router struct { @@ -39,6 +40,14 @@ type Routers struct { List []Router } +func (e *Application) SetBefore(f func()) { + e.before = append(e.before, f) +} + +func (e *Application) GetBefore() []func() { + return e.before +} + // SetCasbinExclude 设置对应key的Exclude func (e *Application) SetCasbinExclude(key string, list interface{}) { e.mux.Lock() diff --git a/sdk/runtime/type.go b/sdk/runtime/type.go index 6548c2ab..eb721432 100644 --- a/sdk/runtime/type.go +++ b/sdk/runtime/type.go @@ -17,6 +17,9 @@ type Runtime interface { GetDb() map[string]*gorm.DB GetDbByKey(key string) *gorm.DB + SetBefore(f func()) + GetBefore() []func() + SetCasbinExclude(key string, list interface{}) GetCasbinExclude() map[string]interface{} GetCasbinExcludeByKey(key string) interface{} From ed8a8a82f874136593d0703356d786b8ec5b19c8 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 7 Mar 2023 20:39:24 +0800 Subject: [PATCH 12/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20config=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/application.go | 32 +++++++++++++++++++++++--------- sdk/runtime/type.go | 6 ++++-- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index 44837830..35b236d3 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -26,10 +26,10 @@ type Application struct { memoryQueue storage.AdapterQueue handler map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc) routers []Router - configs map[string]interface{} // 系统参数 - appRouters []func() // app路由 - casbinExclude map[string]interface{} // casbin排除 - before []func() // 启动前执行 + configs map[string]map[string]interface{} // 系统参数 + appRouters []func() // app路由 + casbinExclude map[string]interface{} // casbin排除 + before []func() // 启动前执行 } type Router struct { @@ -163,7 +163,7 @@ func NewConfig() *Application { memoryQueue: queue.NewMemory(10000), handler: make(map[string][]func(r *gin.RouterGroup, hand ...*gin.HandlerFunc)), routers: make([]Router, 0), - configs: make(map[string]interface{}), + configs: make(map[string]map[string]interface{}), casbinExclude: make(map[string]interface{}), } } @@ -286,18 +286,32 @@ func (e *Application) GetMemoryQueue(prefix string) storage.AdapterQueue { return NewQueue(prefix, e.memoryQueue) } +// SetConfigByTenant 设置对应租户的config +func (e *Application) SetConfigByTenant(tenant string, value map[string]interface{}) { + e.mux.Lock() + defer e.mux.Unlock() + e.configs[tenant] = value +} + // SetConfig 设置对应key的config -func (e *Application) SetConfig(key string, value interface{}) { +func (e *Application) SetConfig(tenant, key string, value interface{}) { e.mux.Lock() defer e.mux.Unlock() - e.configs[key] = value + e.configs[tenant][key] = value } // GetConfig 获取对应key的config -func (e *Application) GetConfig(key string) interface{} { +func (e *Application) GetConfig(tenant, key string) interface{} { + e.mux.Lock() + defer e.mux.Unlock() + return e.configs[tenant][key] +} + +// GetConfigByTenant 获取对应租户的config +func (e *Application) GetConfigByTenant(tenant string) interface{} { e.mux.Lock() defer e.mux.Unlock() - return e.configs[key] + return e.configs[tenant] } // SetAppRouters 设置app的路由 diff --git a/sdk/runtime/type.go b/sdk/runtime/type.go index eb721432..b8a0fd19 100644 --- a/sdk/runtime/type.go +++ b/sdk/runtime/type.go @@ -68,8 +68,10 @@ type Runtime interface { GetStreamMessage(id, stream string, value map[string]interface{}) (storage.Messager, error) - GetConfig(key string) interface{} - SetConfig(key string, value interface{}) + GetConfigByTenant(tenant string) interface{} + GetConfig(tenant, key string) interface{} + SetConfigByTenant(tenant string, value map[string]interface{}) + SetConfig(tenant, key string, value interface{}) // SetAppRouters set AppRouter SetAppRouters(appRouters func()) From 419e92b7a97a9958c7e205b7cbeb82518880a08b Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Tue, 7 Mar 2023 21:34:07 +0800 Subject: [PATCH 13/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20config=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/application.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index 35b236d3..e2ce7e09 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -297,6 +297,9 @@ func (e *Application) SetConfigByTenant(tenant string, value map[string]interfac func (e *Application) SetConfig(tenant, key string, value interface{}) { e.mux.Lock() defer e.mux.Unlock() + if _, ok := e.configs[tenant]; !ok { + e.configs[tenant] = make(map[string]interface{}) + } e.configs[tenant][key] = value } From 9c9d0cc58dde40fdfac79c96750b03d6085cd368 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 14 May 2023 10:33:43 +0800 Subject: [PATCH 14/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20update=20log=20def?= =?UTF-8?q?ault?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logger/default.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logger/default.go b/logger/default.go index 1cb71dfe..2c099de3 100644 --- a/logger/default.go +++ b/logger/default.go @@ -97,7 +97,7 @@ func (l *defaultLogger) logf(level Level, format string, v ...interface{}) { fields := copyFields(l.opts.Fields) l.RUnlock() - fields["level"] = level.String() + //fields["level"] = level.String() if _, file, line, ok := runtime.Caller(l.opts.CallerSkipCount); ok && level.String() == "error" { fields["file"] = fmt.Sprintf("%s:%d", logCallerfilePath(file), line) @@ -143,7 +143,7 @@ func (l *defaultLogger) logf(level Level, format string, v ...interface{}) { if name == "" { logStr = fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message) } else { - logStr = fmt.Sprintf("%s %s %s %v\n", name, t, metadata, rec.Message) + logStr = fmt.Sprintf("%s %s %s %s %v\n", name, t, level.String(), metadata, rec.Message) } _, err := l.opts.Out.Write([]byte(logStr)) if err != nil { From eae7ff9640da9a8291386364c03c3e561b4d14ff Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 14 May 2023 10:39:11 +0800 Subject: [PATCH 15/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20update=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 40 ++++++++++++++++++++++++---------------- sdk/go.mod | 39 ++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/go.mod b/go.mod index 258f930c..8899a5ab 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/bsm/redislock v0.8.2 github.com/fsnotify/fsnotify v1.4.9 github.com/ghodss/yaml v1.0.0 - github.com/gin-gonic/gin v1.7.7 + github.com/gin-gonic/gin v1.9.0 github.com/go-admin-team/redisqueue/v2 v2.0.0 github.com/go-redis/redis/v9 v9.0.0-rc.1 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 @@ -16,17 +16,17 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/imdario/mergo v0.3.9 - github.com/json-iterator/go v1.1.11 + github.com/json-iterator/go v1.1.12 github.com/nsqio/go-nsq v1.0.8 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.11.0 + github.com/prometheus/client_golang v1.11.1 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/smartystreets/goconvey v1.6.4 github.com/spf13/cast v1.3.1 github.com/xuri/excelize/v2 v2.6.1 - golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 + golang.org/x/crypto v0.5.0 google.golang.org/grpc v1.29.1 - google.golang.org/protobuf v1.28.0 + google.golang.org/protobuf v1.28.1 gorm.io/driver/mysql v1.4.4 gorm.io/gorm v1.24.2 gorm.io/plugin/dbresolver v1.3.0 @@ -35,15 +35,18 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect + github.com/bytedance/sonic v1.8.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fatih/color v1.7.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect - github.com/go-playground/locales v0.13.0 // indirect - github.com/go-playground/universal-translator v0.17.0 // indirect - github.com/go-playground/validator/v10 v10.4.1 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.11.2 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/goccy/go-json v0.10.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.1 // indirect github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect @@ -51,16 +54,18 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/leodido/go-urn v1.2.0 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/leodido/go-urn v1.2.1 // indirect github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/goveralls v0.0.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/opentracing/opentracing-go v1.1.0 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect @@ -68,17 +73,20 @@ require ( github.com/richardlehane/msoleps v1.0.3 // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect - github.com/ugorji/go/codec v1.1.7 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.9 // indirect github.com/urfave/cli v1.20.0 // indirect github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect - golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect - golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/image v0.1.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect golang.org/x/tools v0.1.12 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index a64d86f6..ee3666d5 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -7,15 +7,15 @@ require ( github.com/bytedance/go-tagexpr/v2 v2.7.12 github.com/casbin/casbin/v2 v2.54.0 github.com/chanxuehong/wechat v0.0.0-20201110083048-0180211b69fd - github.com/gin-gonic/gin v1.7.7 + github.com/gin-gonic/gin v1.9.0 github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d github.com/go-admin-team/gorm-adapter/v3 v3.7.8-0.20221127063444-bc66b935a0ab github.com/go-admin-team/redis-watcher/v2 v2.0.0-20221121052608-058cebff72c2 github.com/go-admin-team/redisqueue/v2 v2.0.0 - github.com/go-playground/locales v0.13.0 - github.com/go-playground/universal-translator v0.17.0 - github.com/go-playground/validator/v10 v10.4.1 + github.com/go-playground/locales v0.14.1 + github.com/go-playground/universal-translator v0.18.1 + github.com/go-playground/validator/v10 v10.11.2 github.com/go-redis/redis/v9 v9.0.0-rc.1 github.com/golang-jwt/jwt/v4 v4.4.2 github.com/google/uuid v1.3.0 @@ -26,7 +26,7 @@ require ( github.com/shamsher31/goimgext v1.0.0 github.com/slok/go-http-metrics v0.9.0 github.com/smartystreets/goconvey v1.6.4 - golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b + golang.org/x/crypto v0.5.0 gorm.io/gorm v1.24.2 ) @@ -35,9 +35,11 @@ require ( github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bitly/go-simplejson v0.5.0 // indirect + github.com/bytedance/sonic v1.8.0 // indirect github.com/casbin/redis-watcher/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/chanxuehong/rand v0.0.0-20201110082127-2f19a1bdd973 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fatih/color v1.7.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect @@ -45,6 +47,7 @@ require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/goccy/go-json v0.10.0 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect @@ -64,42 +67,48 @@ require ( github.com/jackc/pgx/v4 v4.17.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect - github.com/json-iterator/go v1.1.11 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/leodido/go-urn v1.2.0 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect + github.com/leodido/go-urn v1.2.1 // indirect github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect github.com/mattn/goveralls v0.0.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/microsoft/go-mssqldb v0.17.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nyaruka/phonenumbers v1.0.55 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_golang v1.11.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/spf13/cast v1.3.1 // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect - github.com/ugorji/go/codec v1.1.7 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.9 // indirect github.com/urfave/cli v1.20.0 // indirect go.uber.org/atomic v1.6.0 // indirect go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.13.0 // indirect - golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect + golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/image v0.1.0 // indirect golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect golang.org/x/tools v0.1.12 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/mysql v1.4.4 // indirect gorm.io/driver/postgres v1.4.5 // indirect gorm.io/driver/sqlite v1.4.3 // indirect From 82cfbad64c68955d0e849042f1fdedee2e42df56 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 14 May 2023 10:50:16 +0800 Subject: [PATCH 16/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20update=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 6 +++--- sdk/go.mod | 27 +++++++++++---------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 8899a5ab..94feffaa 100644 --- a/go.mod +++ b/go.mod @@ -27,8 +27,8 @@ require ( golang.org/x/crypto v0.5.0 google.golang.org/grpc v1.29.1 google.golang.org/protobuf v1.28.1 - gorm.io/driver/mysql v1.4.4 - gorm.io/gorm v1.24.2 + gorm.io/driver/mysql v1.5.0 + gorm.io/gorm v1.25.1 gorm.io/plugin/dbresolver v1.3.0 ) @@ -45,7 +45,7 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.11.2 // indirect - github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.1 // indirect diff --git a/sdk/go.mod b/sdk/go.mod index ee3666d5..602f936c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -26,8 +26,8 @@ require ( github.com/shamsher31/goimgext v1.0.0 github.com/slok/go-http-metrics v0.9.0 github.com/smartystreets/goconvey v1.6.4 - golang.org/x/crypto v0.5.0 - gorm.io/gorm v1.24.2 + golang.org/x/crypto v0.6.0 + gorm.io/gorm v1.25.1 ) require ( @@ -46,7 +46,7 @@ require ( github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect - github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.0 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect @@ -57,14 +57,9 @@ require ( github.com/henrylee2cn/ameda v1.4.10 // indirect github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 // indirect github.com/imdario/mergo v0.3.9 // indirect - github.com/jackc/chunkreader/v2 v2.0.1 // indirect - github.com/jackc/pgconn v1.13.0 // indirect - github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgproto3/v2 v2.3.1 // indirect - github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect - github.com/jackc/pgtype v1.12.0 // indirect - github.com/jackc/pgx/v4 v4.17.2 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgx/v5 v5.3.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -78,7 +73,7 @@ require ( github.com/mattn/goveralls v0.0.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect - github.com/microsoft/go-mssqldb v0.17.0 // indirect + github.com/microsoft/go-mssqldb v0.21.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nyaruka/phonenumbers v1.0.55 // indirect @@ -109,11 +104,11 @@ require ( gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/driver/mysql v1.4.4 // indirect - gorm.io/driver/postgres v1.4.5 // indirect - gorm.io/driver/sqlite v1.4.3 // indirect - gorm.io/driver/sqlserver v1.4.1 // indirect - gorm.io/plugin/dbresolver v1.3.0 // indirect + gorm.io/driver/mysql v1.5.0 // indirect + gorm.io/driver/postgres v1.5.0 // indirect + gorm.io/driver/sqlite v1.5.0 // indirect + gorm.io/driver/sqlserver v1.4.3 // indirect + gorm.io/plugin/dbresolver v1.4.1 // indirect ) //replace github.com/go-admin-team/go-admin-core => ../ From 139ec399bb979011813488f8b4794c0aea9f7060 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 14 May 2023 11:10:06 +0800 Subject: [PATCH 17/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20update=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- sdk/go.mod | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 94feffaa..203b06ad 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/go-admin-team/go-admin-core -go 1.18 +go 1.20 require ( github.com/BurntSushi/toml v0.3.1 diff --git a/sdk/go.mod b/sdk/go.mod index 602f936c..913dbb28 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,11 +1,11 @@ module github.com/go-admin-team/go-admin-core/sdk -go 1.18 +go 1.20 require ( github.com/bsm/redislock v0.8.2 github.com/bytedance/go-tagexpr/v2 v2.7.12 - github.com/casbin/casbin/v2 v2.54.0 + github.com/casbin/casbin/v2 v2.69.0 github.com/chanxuehong/wechat v0.0.0-20201110083048-0180211b69fd github.com/gin-gonic/gin v1.9.0 github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f @@ -21,10 +21,10 @@ require ( github.com/google/uuid v1.3.0 github.com/gorilla/websocket v1.4.2 github.com/mojocn/base64Captcha v1.3.1 - github.com/nsqio/go-nsq v1.0.8 + github.com/nsqio/go-nsq v1.1.0 github.com/robfig/cron/v3 v3.0.1 github.com/shamsher31/goimgext v1.0.0 - github.com/slok/go-http-metrics v0.9.0 + github.com/slok/go-http-metrics v0.10.0 github.com/smartystreets/goconvey v1.6.4 golang.org/x/crypto v0.6.0 gorm.io/gorm v1.25.1 @@ -67,7 +67,7 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/leodido/go-urn v1.2.1 // indirect - github.com/mattn/go-colorable v0.1.7 // indirect + github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect github.com/mattn/goveralls v0.0.2 // indirect @@ -81,7 +81,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.11.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/common v0.28.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/spf13/cast v1.3.1 // indirect @@ -94,7 +94,7 @@ require ( go.uber.org/zap v1.13.0 // indirect golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/image v0.1.0 // indirect - golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect + golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect From 7b96fbf9a218b0b45456cc161dcdd5030d50281a Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Sun, 14 May 2023 11:37:29 +0800 Subject: [PATCH 18/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20update=20logger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logger/default.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logger/default.go b/logger/default.go index 2c099de3..a616da81 100644 --- a/logger/default.go +++ b/logger/default.go @@ -141,7 +141,7 @@ func (l *defaultLogger) logf(level Level, format string, v ...interface{}) { //fmt.Printf("%v\n", rec.Message) logStr := "" if name == "" { - logStr = fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message) + logStr = fmt.Sprintf("%s %s %s %v\n", t, level.String(), metadata, rec.Message) } else { logStr = fmt.Sprintf("%s %s %s %s %v\n", name, t, level.String(), metadata, rec.Message) } From 3dc3681c40d3577ce3ebbaa1aeace8767427078f Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Tue, 1 Aug 2023 21:46:34 +0800 Subject: [PATCH 19/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20Add=20app=20to=20r?= =?UTF-8?q?untime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/application.go | 25 +++++++++++++++++++++++++ sdk/runtime/type.go | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/sdk/runtime/application.go b/sdk/runtime/application.go index e2ce7e09..306a2e36 100644 --- a/sdk/runtime/application.go +++ b/sdk/runtime/application.go @@ -30,6 +30,7 @@ type Application struct { appRouters []func() // app路由 casbinExclude map[string]interface{} // casbin排除 before []func() // 启动前执行 + app map[string]interface{} // app } type Router struct { @@ -72,6 +73,30 @@ func (e *Application) GetCasbinExcludeByKey(key string) interface{} { return e.casbinExclude[key] } +// SetApp 设置对应key的app +func (e *Application) SetApp(key string, app interface{}) { + e.mux.Lock() + defer e.mux.Unlock() + e.app[key] = app +} + +// GetApp 获取所有map里的app数据 +func (e *Application) GetApp() map[string]interface{} { + e.mux.Lock() + defer e.mux.Unlock() + return e.app +} + +// GetAppByKey 根据key获取app +func (e *Application) GetAppByKey(key string) interface{} { + e.mux.Lock() + defer e.mux.Unlock() + if app, ok := e.app["*"]; ok { + return app + } + return e.app[key] +} + // SetDb 设置对应key的db func (e *Application) SetDb(key string, db *gorm.DB) { e.mux.Lock() diff --git a/sdk/runtime/type.go b/sdk/runtime/type.go index b8a0fd19..74302ad9 100644 --- a/sdk/runtime/type.go +++ b/sdk/runtime/type.go @@ -17,6 +17,10 @@ type Runtime interface { GetDb() map[string]*gorm.DB GetDbByKey(key string) *gorm.DB + SetApp(key string, app interface{}) + GetApp() map[string]interface{} + GetAppByKey(key string) interface{} + SetBefore(f func()) GetBefore() []func() From 53d8d21153ada87d839fce1fe40f6c9e02af5e01 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Tue, 1 Aug 2023 21:48:36 +0800 Subject: [PATCH 20/59] =?UTF-8?q?perf=F0=9F=91=8C:=20=20Upgrade=20gin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- sdk/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 203b06ad..f6a2f63c 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/bsm/redislock v0.8.2 github.com/fsnotify/fsnotify v1.4.9 github.com/ghodss/yaml v1.0.0 - github.com/gin-gonic/gin v1.9.0 + github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/redisqueue/v2 v2.0.0 github.com/go-redis/redis/v9 v9.0.0-rc.1 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 diff --git a/sdk/go.mod b/sdk/go.mod index 913dbb28..0015d9e1 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -7,7 +7,7 @@ require ( github.com/bytedance/go-tagexpr/v2 v2.7.12 github.com/casbin/casbin/v2 v2.69.0 github.com/chanxuehong/wechat v0.0.0-20201110083048-0180211b69fd - github.com/gin-gonic/gin v1.9.0 + github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d github.com/go-admin-team/gorm-adapter/v3 v3.7.8-0.20221127063444-bc66b935a0ab From 28a19588d9d49d56b2d5717e65eda3954a6e3946 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Thu, 2 Nov 2023 17:31:49 +0800 Subject: [PATCH 21/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0gomod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 30 +++++++++++++++--------------- sdk/go.mod | 30 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index f6a2f63c..9819ddc4 100644 --- a/go.mod +++ b/go.mod @@ -24,9 +24,9 @@ require ( github.com/smartystreets/goconvey v1.6.4 github.com/spf13/cast v1.3.1 github.com/xuri/excelize/v2 v2.6.1 - golang.org/x/crypto v0.5.0 + golang.org/x/crypto v0.9.0 google.golang.org/grpc v1.29.1 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.30.0 gorm.io/driver/mysql v1.5.0 gorm.io/gorm v1.25.1 gorm.io/plugin/dbresolver v1.3.0 @@ -35,7 +35,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect - github.com/bytedance/sonic v1.8.0 // indirect + github.com/bytedance/sonic v1.9.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect @@ -44,9 +44,9 @@ require ( github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.11.2 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect - github.com/goccy/go-json v0.10.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.1 // indirect github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect @@ -54,10 +54,10 @@ require ( github.com/jinzhu/now v1.1.5 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect - github.com/leodido/go-urn v1.2.1 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/goveralls v0.0.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect @@ -65,7 +65,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/opentracing/opentracing-go v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect @@ -74,16 +74,16 @@ require ( github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.9 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect github.com/urfave/cli v1.20.0 // indirect github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect - golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.1.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - golang.org/x/tools v0.1.12 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.6.0 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect diff --git a/sdk/go.mod b/sdk/go.mod index 0015d9e1..364ad717 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-admin-team/redisqueue/v2 v2.0.0 github.com/go-playground/locales v0.14.1 github.com/go-playground/universal-translator v0.18.1 - github.com/go-playground/validator/v10 v10.11.2 + github.com/go-playground/validator/v10 v10.14.0 github.com/go-redis/redis/v9 v9.0.0-rc.1 github.com/golang-jwt/jwt/v4 v4.4.2 github.com/google/uuid v1.3.0 @@ -26,7 +26,7 @@ require ( github.com/shamsher31/goimgext v1.0.0 github.com/slok/go-http-metrics v0.10.0 github.com/smartystreets/goconvey v1.6.4 - golang.org/x/crypto v0.6.0 + golang.org/x/crypto v0.9.0 gorm.io/gorm v1.25.1 ) @@ -35,7 +35,7 @@ require ( github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bitly/go-simplejson v0.5.0 // indirect - github.com/bytedance/sonic v1.8.0 // indirect + github.com/bytedance/sonic v1.9.1 // indirect github.com/casbin/redis-watcher/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/chanxuehong/rand v0.0.0-20201110082127-2f19a1bdd973 // indirect @@ -47,7 +47,7 @@ require ( github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect - github.com/goccy/go-json v0.10.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect @@ -65,10 +65,10 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect - github.com/leodido/go-urn v1.2.1 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-colorable v0.1.8 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect github.com/mattn/goveralls v0.0.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect @@ -77,7 +77,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nyaruka/phonenumbers v1.0.55 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.11.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect @@ -87,19 +87,19 @@ require ( github.com/spf13/cast v1.3.1 // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.9 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect github.com/urfave/cli v1.20.0 // indirect go.uber.org/atomic v1.6.0 // indirect go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.13.0 // indirect - golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect + golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.1.0 // indirect golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - golang.org/x/tools v0.1.12 // indirect - google.golang.org/protobuf v1.28.1 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + golang.org/x/tools v0.6.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect From 2ba178d83e12d5a213c4b6265503fae5d528f05a Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:31:41 +0800 Subject: [PATCH 22/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug/writer/file.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/debug/writer/file.go b/debug/writer/file.go index eafb2aa7..2821ceaa 100644 --- a/debug/writer/file.go +++ b/debug/writer/file.go @@ -3,6 +3,7 @@ package writer import ( "errors" "fmt" + "io/ioutil" "log" "os" "path/filepath" @@ -88,6 +89,30 @@ func (p *FileWriter) checkFile() { filename := p.getFilename() _ = p.file.Close() p.file, _ = os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_SYNC, 0600) + + dir := filepath.Dir(p.file.Name()) + fmt.Println("File directory:", dir) + files, err := ioutil.ReadDir(dir) + if err != nil { + fmt.Println("Error reading log directory:", err) + return + } + + for _, file := range files { + if !file.IsDir() && strings.HasSuffix(file.Name(), p.opts.suffix) { + filePath := filepath.Join(dir, file.Name()) + fileModTime := file.ModTime() + daysSinceMod := uint(time.Since(fileModTime).Hours() / 24) + if daysSinceMod > p.opts.daysToKeep { + err := os.Remove(filePath) + if err != nil { + fmt.Println("Error deleting file:", err) + } else { + fmt.Println("Deleted file:", filePath) + } + } + } + } } } From 1a2a521447868a15afae26ab6115cb4f0d982cbd Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:32:03 +0800 Subject: [PATCH 23/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/config/logger.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sdk/config/logger.go b/sdk/config/logger.go index dbfc3b45..bfd061e4 100644 --- a/sdk/config/logger.go +++ b/sdk/config/logger.go @@ -3,12 +3,13 @@ package config import "github.com/go-admin-team/go-admin-core/sdk/pkg/logger" type Logger struct { - Type string - Path string - Level string - Stdout string - EnabledDB bool - Cap uint + Type string + Path string + Level string + Stdout string + EnabledDB bool + Cap uint + DaysToKeep uint } // Setup 设置logger @@ -19,6 +20,7 @@ func (e Logger) Setup() { logger.WithLevel(e.Level), logger.WithStdout(e.Stdout), logger.WithCap(e.Cap), + logger.WithDaysToKeep(e.DaysToKeep), ) } From f05b2931ccd86a152722ecb600c3b54d16d74af3 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:32:33 +0800 Subject: [PATCH 24/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20redis=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 103 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 57 insertions(+), 46 deletions(-) diff --git a/go.mod b/go.mod index 258f930c..8e45e05f 100644 --- a/go.mod +++ b/go.mod @@ -3,82 +3,93 @@ module github.com/go-admin-team/go-admin-core go 1.18 require ( - github.com/BurntSushi/toml v0.3.1 - github.com/bitly/go-simplejson v0.5.0 - github.com/bsm/redislock v0.8.2 - github.com/fsnotify/fsnotify v1.4.9 + dario.cat/mergo v1.0.0 + github.com/BurntSushi/toml v1.3.2 + github.com/bitly/go-simplejson v0.5.1 + github.com/bsm/redislock v0.9.4 + github.com/fsnotify/fsnotify v1.7.0 github.com/ghodss/yaml v1.0.0 - github.com/gin-gonic/gin v1.7.7 + github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/redisqueue/v2 v2.0.0 - github.com/go-redis/redis/v9 v9.0.0-rc.1 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 - github.com/google/uuid v1.3.0 - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 + github.com/google/uuid v1.4.0 + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 - github.com/imdario/mergo v0.3.9 - github.com/json-iterator/go v1.1.11 - github.com/nsqio/go-nsq v1.0.8 + github.com/json-iterator/go v1.1.12 + github.com/nsqio/go-nsq v1.1.0 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.11.0 + github.com/prometheus/client_golang v1.17.0 + github.com/redis/go-redis/v9 v9.3.0 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e - github.com/smartystreets/goconvey v1.6.4 - github.com/spf13/cast v1.3.1 - github.com/xuri/excelize/v2 v2.6.1 - golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 - google.golang.org/grpc v1.29.1 - google.golang.org/protobuf v1.28.0 - gorm.io/driver/mysql v1.4.4 - gorm.io/gorm v1.24.2 - gorm.io/plugin/dbresolver v1.3.0 + github.com/smartystreets/goconvey v1.8.1 + github.com/spf13/cast v1.5.1 + github.com/xuri/excelize/v2 v2.8.0 + golang.org/x/crypto v0.14.0 + google.golang.org/grpc v1.59.0 + google.golang.org/protobuf v1.31.0 + gorm.io/driver/mysql v1.5.2 + gorm.io/gorm v1.25.5 + gorm.io/plugin/dbresolver v1.4.7 ) require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/bytedance/sonic v1.10.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect + github.com/chenzhuoyu/iasm v0.9.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fatih/color v1.7.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect - github.com/go-playground/locales v0.13.0 // indirect - github.com/go-playground/universal-translator v0.17.0 // indirect - github.com/go-playground/validator/v10 v10.4.1 // indirect - github.com/go-sql-driver/mysql v1.6.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect + github.com/go-redis/redis/v9 v9.0.0-rc.1 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.1 // indirect - github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect + github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/imdario/mergo v0.3.7 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/leodido/go-urn v1.2.0 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/goveralls v0.0.2 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/opentracing/opentracing-go v1.1.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.26.0 // indirect - github.com/prometheus/procfs v0.6.0 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.1 // indirect github.com/richardlehane/mscfb v1.0.4 // indirect github.com/richardlehane/msoleps v1.0.3 // indirect - github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect + github.com/smarty/assertions v1.15.0 // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect - github.com/ugorji/go/codec v1.1.7 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect github.com/urfave/cli v1.20.0 // indirect - github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect - github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect - golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect - golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/tools v0.1.12 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + github.com/xuri/efp v0.0.0-20230802181842-ad255f2331ca // indirect + github.com/xuri/nfp v0.0.0-20230819163627-dc951e3ffe1a // indirect + golang.org/x/arch v0.3.0 // indirect + golang.org/x/image v0.11.0 // indirect + golang.org/x/net v0.14.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.7.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) From e06921ac4e588c514a83776c593f522cf648294f Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:32:53 +0800 Subject: [PATCH 25/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20redis=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage/cache/redis.go | 2 +- storage/locker/redis.go | 2 +- storage/queue/redis.go | 2 +- storage/queue/redis_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/cache/redis.go b/storage/cache/redis.go index 104a9d91..31412714 100644 --- a/storage/cache/redis.go +++ b/storage/cache/redis.go @@ -2,7 +2,7 @@ package cache import ( "context" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" "time" ) diff --git a/storage/locker/redis.go b/storage/locker/redis.go index 3e6742a8..2705b814 100644 --- a/storage/locker/redis.go +++ b/storage/locker/redis.go @@ -2,7 +2,7 @@ package locker import ( "context" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" "time" "github.com/bsm/redislock" diff --git a/storage/queue/redis.go b/storage/queue/redis.go index 36fccdf6..6b0ed843 100644 --- a/storage/queue/redis.go +++ b/storage/queue/redis.go @@ -3,7 +3,7 @@ package queue import ( "github.com/go-admin-team/go-admin-core/storage" "github.com/go-admin-team/redisqueue/v2" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" ) // NewRedis redis模式 diff --git a/storage/queue/redis_test.go b/storage/queue/redis_test.go index 42a98e28..144e521c 100644 --- a/storage/queue/redis_test.go +++ b/storage/queue/redis_test.go @@ -3,7 +3,7 @@ package queue import ( "fmt" "github.com/go-admin-team/redisqueue/v2" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" "sync" "testing" "time" From 7771f9b32dd0ef5e90a3abf2f39878c7fd5988b1 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:33:02 +0800 Subject: [PATCH 26/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20redis=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/pkg/casbin/mycasbin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/pkg/casbin/mycasbin.go b/sdk/pkg/casbin/mycasbin.go index e4f5bf93..faad084d 100644 --- a/sdk/pkg/casbin/mycasbin.go +++ b/sdk/pkg/casbin/mycasbin.go @@ -10,7 +10,7 @@ import ( "github.com/go-admin-team/go-admin-core/sdk" "github.com/go-admin-team/go-admin-core/sdk/config" redisWatcher "github.com/go-admin-team/redis-watcher/v2" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" "gorm.io/gorm" gormAdapter "github.com/go-admin-team/gorm-adapter/v3" From 2a50dcab653098c9fb794372eedd5f36abedadf0 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:33:38 +0800 Subject: [PATCH 27/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20redis=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/config/option_redis.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/config/option_redis.go b/sdk/config/option_redis.go index af6c5390..0490f9a4 100644 --- a/sdk/config/option_redis.go +++ b/sdk/config/option_redis.go @@ -5,9 +5,8 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "github.com/redis/go-redis/v9" "io/ioutil" - - "github.com/go-redis/redis/v9" ) var _redis *redis.Client From dde72b0fe5f835bdba70556146ff870a645f59db Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:33:59 +0800 Subject: [PATCH 28/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20redis=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/config/queue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/config/queue.go b/sdk/config/queue.go index b4be3a4f..c137f66b 100644 --- a/sdk/config/queue.go +++ b/sdk/config/queue.go @@ -4,7 +4,7 @@ import ( "github.com/go-admin-team/go-admin-core/storage" "github.com/go-admin-team/go-admin-core/storage/queue" "github.com/go-admin-team/redisqueue/v2" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" "time" ) From dc27e0555000d1483cd9cb5102c90d0156b7801e Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:34:37 +0800 Subject: [PATCH 29/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20update=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logger/default.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/logger/default.go b/logger/default.go index 1cb71dfe..b595eb35 100644 --- a/logger/default.go +++ b/logger/default.go @@ -135,10 +135,6 @@ func (l *defaultLogger) logf(level Level, format string, v ...interface{}) { name = "[" + l.opts.Name + "]" } t := rec.Timestamp.Format("2006-01-02 15:04:05.000Z0700") - //fmt.Printf("%s\n", t) - //fmt.Printf("%s\n", name) - //fmt.Printf("%s\n", metadata) - //fmt.Printf("%v\n", rec.Message) logStr := "" if name == "" { logStr = fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message) From 87e7fd75e2024ae7bcd90e372c05f4f5b8f0a5d5 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:34:58 +0800 Subject: [PATCH 30/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/runtime/queue_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/runtime/queue_test.go b/sdk/runtime/queue_test.go index d68dd5bd..903fbc32 100644 --- a/sdk/runtime/queue_test.go +++ b/sdk/runtime/queue_test.go @@ -3,7 +3,7 @@ package runtime import ( "fmt" "github.com/go-admin-team/redisqueue/v2" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" "reflect" "testing" "time" From c3acc488c9fb3f089573d09ad8f220bd324935ce Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:35:07 +0800 Subject: [PATCH 31/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/reader/json/json.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/reader/json/json.go b/config/reader/json/json.go index 588258f5..9150ae96 100644 --- a/config/reader/json/json.go +++ b/config/reader/json/json.go @@ -4,11 +4,11 @@ import ( "errors" "time" + "dario.cat/mergo" "github.com/go-admin-team/go-admin-core/config/encoder" "github.com/go-admin-team/go-admin-core/config/encoder/json" "github.com/go-admin-team/go-admin-core/config/reader" "github.com/go-admin-team/go-admin-core/config/source" - "github.com/imdario/mergo" ) const readerTyp = "json" From b6b9f8fcd1ea0eff7c4df8def98578ad92549535 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:35:15 +0800 Subject: [PATCH 32/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/source/env/env.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/config/source/env/env.go b/config/source/env/env.go index bdabcfc5..a5a588c6 100644 --- a/config/source/env/env.go +++ b/config/source/env/env.go @@ -6,8 +6,8 @@ import ( "strings" "time" + "dario.cat/mergo" "github.com/go-admin-team/go-admin-core/config/source" - "github.com/imdario/mergo" ) var ( @@ -117,15 +117,16 @@ func (e *env) String() string { // Underscores are delimiters for nesting, and all keys are lowercased. // // Example: -// "DATABASE_SERVER_HOST=localhost" will convert to // -// { -// "database": { -// "server": { -// "host": "localhost" -// } -// } -// } +// "DATABASE_SERVER_HOST=localhost" will convert to +// +// { +// "database": { +// "server": { +// "host": "localhost" +// } +// } +// } func NewSource(opts ...source.Option) source.Source { options := source.NewOptions(opts...) From 2449cb6d823674268e27c86c578dd7f240ffc2a0 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:35:21 +0800 Subject: [PATCH 33/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/source/flag/flag.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/config/source/flag/flag.go b/config/source/flag/flag.go index cd233e2d..acb36cca 100644 --- a/config/source/flag/flag.go +++ b/config/source/flag/flag.go @@ -1,10 +1,10 @@ package flag import ( + "dario.cat/mergo" "errors" "flag" "github.com/go-admin-team/go-admin-core/config/source" - "github.com/imdario/mergo" "strings" "time" ) @@ -89,13 +89,14 @@ func (fs *flagsrc) String() string { // Hyphens are delimiters for nesting, and all keys are lowercased. // // Example: -// dbhost := flag.String("database-host", "localhost", "the db host name") // -// { -// "database": { -// "host": "localhost" -// } -// } +// dbhost := flag.String("database-host", "localhost", "the db host name") +// +// { +// "database": { +// "host": "localhost" +// } +// } func NewSource(opts ...source.Option) source.Source { return &flagsrc{opts: source.NewOptions(opts...)} } From 15be27ef0cfdeb72b3608a88c79026047b08c6f0 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:35:30 +0800 Subject: [PATCH 34/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 121 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 75 insertions(+), 46 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index 57e96de4..bae897e0 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,60 +1,73 @@ module github.com/go-admin-team/go-admin-core/sdk -go 1.18 +go 1.20 require ( - github.com/bsm/redislock v0.8.2 - github.com/bytedance/go-tagexpr/v2 v2.7.12 - github.com/casbin/casbin/v2 v2.54.0 - github.com/chanxuehong/wechat v0.0.0-20201110083048-0180211b69fd - github.com/gin-gonic/gin v1.7.7 + github.com/bsm/redislock v0.9.4 + github.com/bytedance/go-tagexpr/v2 v2.9.11 + github.com/casbin/casbin/v2 v2.77.2 + github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd + github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 - github.com/go-admin-team/redis-watcher/v2 v2.0.0-20221121052608-058cebff72c2 - github.com/go-admin-team/redisqueue/v2 v2.0.0-20221119141731-97c556b0d5b7 - github.com/go-playground/locales v0.13.0 - github.com/go-playground/universal-translator v0.17.0 - github.com/go-playground/validator/v10 v10.4.1 - github.com/go-redis/redis/v9 v9.0.0-rc.1 - github.com/golang-jwt/jwt/v4 v4.4.2 - github.com/google/uuid v1.3.0 - github.com/gorilla/websocket v1.4.2 - github.com/mojocn/base64Captcha v1.3.1 - github.com/nsqio/go-nsq v1.0.8 + github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 + github.com/go-admin-team/redisqueue/v2 v2.0.1-0.20231102124201-508101cc789a + github.com/go-playground/locales v0.14.1 + github.com/go-playground/universal-translator v0.18.1 + github.com/go-playground/validator/v10 v10.15.5 + github.com/golang-jwt/jwt/v4 v4.5.0 + github.com/google/uuid v1.4.0 + github.com/gorilla/websocket v1.5.0 + github.com/mojocn/base64Captcha v1.3.5 + github.com/nsqio/go-nsq v1.1.0 + github.com/redis/go-redis/v9 v9.3.0 github.com/robfig/cron/v3 v3.0.1 github.com/shamsher31/goimgext v1.0.0 github.com/slok/go-http-metrics v0.9.0 - github.com/smartystreets/goconvey v1.6.4 - golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b - gorm.io/gorm v1.24.2 + github.com/smartystreets/goconvey v1.8.1 + golang.org/x/crypto v0.14.0 + gorm.io/gorm v1.25.5 ) require ( - github.com/BurntSushi/toml v0.3.1 // indirect + github.com/AlecAivazis/survey/v2 v2.3.6 // indirect + github.com/BurntSushi/toml v1.2.1 // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/sprig/v3 v3.2.3 // indirect + github.com/andeya/ameda v1.5.3 // indirect + github.com/andeya/goutil v1.0.1 // indirect + github.com/andygrunwald/go-jira v1.16.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bitly/go-simplejson v0.5.0 // indirect - github.com/casbin/redis-watcher/v2 v2.3.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/chanxuehong/rand v0.0.0-20201110082127-2f19a1bdd973 // indirect + github.com/bytedance/sonic v1.9.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/chanxuehong/rand v0.0.0-20211009035549-2f07823e8e99 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/coreos/go-semver v0.3.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/fatih/color v1.7.0 // indirect + github.com/fatih/color v1.15.0 // indirect + github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f // indirect - github.com/go-redis/redis/v8 v8.11.5 // indirect + github.com/git-chglog/git-chglog v0.15.4 // indirect + github.com/go-redis/redis/v9 v9.0.0-rc.1 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.1 // indirect - github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect - github.com/henrylee2cn/ameda v1.4.10 // indirect - github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 // indirect - github.com/imdario/mergo v0.3.9 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/huandu/xstrings v1.3.3 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.13.0 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -65,42 +78,58 @@ require ( github.com/jackc/pgx/v4 v4.17.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect - github.com/json-iterator/go v1.1.11 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/leodido/go-urn v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/kyokomi/emoji/v2 v2.2.11 // indirect + github.com/leodido/go-urn v1.2.4 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect - github.com/mattn/goveralls v0.0.2 // indirect + github.com/mattn/goveralls v0.0.12 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/microsoft/go-mssqldb v0.17.0 // indirect + github.com/mitchellh/copystructure v1.0.0 // indirect + github.com/mitchellh/reflectwalk v1.0.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nyaruka/phonenumbers v1.0.55 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.11.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.26.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect - github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/shopspring/decimal v1.2.0 // indirect + github.com/smarty/assertions v1.15.0 // indirect github.com/spf13/cast v1.3.1 // indirect + github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/trivago/tgo v1.0.7 // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect - github.com/ugorji/go/codec v1.1.7 // indirect - github.com/urfave/cli v1.20.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect + github.com/urfave/cli/v2 v2.24.3 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.uber.org/atomic v1.6.0 // indirect go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.13.0 // indirect + golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect - golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect - golang.org/x/text v0.3.7 // indirect - golang.org/x/tools v0.1.12 // indirect - google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect - gopkg.in/kyokomi/emoji.v1 v1.5.1 // indirect + golang.org/x/mod v0.10.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + golang.org/x/tools v0.8.0 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/mysql v1.4.4 // indirect gorm.io/driver/postgres v1.4.5 // indirect gorm.io/driver/sqlite v1.4.3 // indirect From 244738def8f9260c63c682a8bcbedba26b716677 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:36:00 +0800 Subject: [PATCH 35/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0log=E4=BF=9D=E7=95=99=E5=A4=A9=E6=95=B0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug/writer/options.go | 23 ++++++++++++++++------- sdk/pkg/logger/options.go | 6 ++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/debug/writer/options.go b/debug/writer/options.go index f745cfab..580a05ff 100644 --- a/debug/writer/options.go +++ b/debug/writer/options.go @@ -9,29 +9,31 @@ package writer // Options 可配置参数 type Options struct { - path string - suffix string //文件扩展名 - cap uint + path string //文件路径 + suffix string //文件扩展名 + daysToKeep uint //保存天数 + cap uint //文件大小 } func setDefault() Options { return Options{ - path: "/tmp/go-admin", - suffix: "log", + path: "/tmp/go-admin", + suffix: "log", + daysToKeep: 7, } } // Option set options type Option func(*Options) -// WithPath set path +// WithPath 设置文件路径 func WithPath(s string) Option { return func(o *Options) { o.path = s } } -// WithSuffix set suffix +// WithSuffix 设置文件扩展名 func WithSuffix(s string) Option { return func(o *Options) { o.suffix = s @@ -44,3 +46,10 @@ func WithCap(n uint) Option { o.cap = n } } + +// WithDaysToKeep 设置文件保留天数 +func WithDaysToKeep(n uint) Option { + return func(o *Options) { + o.daysToKeep = n + } +} diff --git a/sdk/pkg/logger/options.go b/sdk/pkg/logger/options.go index 60395698..193df49a 100644 --- a/sdk/pkg/logger/options.go +++ b/sdk/pkg/logger/options.go @@ -55,3 +55,9 @@ func WithCap(n uint) Option { o.cap = n } } + +func WithDaysToKeep(n uint) Option { + return func(o *options) { + o.cap = n + } +} From 6b9b9aa1db5f36fb44d6b528facd386a18a18557 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 14:36:16 +0800 Subject: [PATCH 36/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/logger/logrus/go.mod | 9 +++------ plugins/logger/zap/go.mod | 8 +++++--- plugins/logger/zap/zap_test.go | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/logger/logrus/go.mod b/plugins/logger/logrus/go.mod index 5503fb31..4119eec3 100644 --- a/plugins/logger/logrus/go.mod +++ b/plugins/logger/logrus/go.mod @@ -1,15 +1,12 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/logrus -go 1.18 +go 1.20 require ( github.com/go-admin-team/go-admin-core v1.3.11 - github.com/sirupsen/logrus v1.8.0 + github.com/sirupsen/logrus v1.9.3 ) -require ( - github.com/magefile/mage v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 // indirect -) +require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect //replace github.com/go-admin-team/go-admin-core => ../../../ diff --git a/plugins/logger/zap/go.mod b/plugins/logger/zap/go.mod index 43ce2f8a..2061f91c 100644 --- a/plugins/logger/zap/go.mod +++ b/plugins/logger/zap/go.mod @@ -1,10 +1,12 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/zap -go 1.18 +go 1.20 require ( github.com/go-admin-team/go-admin-core v1.3.11 - go.uber.org/zap v1.10.0 + go.uber.org/zap v1.26.0 ) -//replace github.com/go-admin-team/go-admin-core => ../../../ +require go.uber.org/multierr v1.10.0 // indirect + +replace github.com/go-admin-team/go-admin-core v1.3.11 => ../../../ diff --git a/plugins/logger/zap/zap_test.go b/plugins/logger/zap/zap_test.go index 3e7fc442..8634578c 100644 --- a/plugins/logger/zap/zap_test.go +++ b/plugins/logger/zap/zap_test.go @@ -67,7 +67,7 @@ func TestFields(t *testing.T) { } func TestFile(t *testing.T) { - output, err := writer.NewFileWriter("testdata", "log") + output, err := writer.NewFileWriter(writer.WithPath("testdata"), writer.WithSuffix("log")) if err != nil { t.Errorf("logger setup error: %s", err.Error()) } @@ -82,3 +82,18 @@ func TestFile(t *testing.T) { fmt.Println(logger.DefaultLogger) logger.DefaultLogger.Log(logger.InfoLevel, "hello") } + +//func TestFileKeep(t *testing.T) { +// output, err := writer.NewFileWriter(writer.WithPath("testdata"), writer.WithSuffix("log")) +// if err != nil { +// t.Errorf("logger setup error: %s", err.Error()) +// } +// //var err error +// logger.DefaultLogger, err = NewLogger(logger.WithLevel(logger.TraceLevel), WithOutput(output)) +// if err != nil { +// t.Errorf("logger setup error: %s", err.Error()) +// } +// +// fmt.Println(logger.DefaultLogger) +// logger. +//} From 7fbaf8ef41ce85e871bb52d4454f9eb3dd3ad73e Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 15:42:47 +0800 Subject: [PATCH 37/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E5=8D=87=E7=BA=A71.21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 3 +-- plugins/logger/logrus/go.mod | 2 +- plugins/logger/zap/go.mod | 4 ++-- sdk/go.mod | 29 ++++++++++++++--------------- sdk/pkg/casbin/log.go | 9 +++++++-- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 8e45e05f..81fac22c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/go-admin-team/go-admin-core -go 1.18 +go 1.21 require ( dario.cat/mergo v1.0.0 @@ -46,7 +46,6 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect - github.com/go-redis/redis/v9 v9.0.0-rc.1 // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang/protobuf v1.5.3 // indirect diff --git a/plugins/logger/logrus/go.mod b/plugins/logger/logrus/go.mod index 4119eec3..68702e3e 100644 --- a/plugins/logger/logrus/go.mod +++ b/plugins/logger/logrus/go.mod @@ -1,6 +1,6 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/logrus -go 1.20 +go 1.21 require ( github.com/go-admin-team/go-admin-core v1.3.11 diff --git a/plugins/logger/zap/go.mod b/plugins/logger/zap/go.mod index 2061f91c..9981b6d8 100644 --- a/plugins/logger/zap/go.mod +++ b/plugins/logger/zap/go.mod @@ -1,6 +1,6 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/zap -go 1.20 +go 1.21 require ( github.com/go-admin-team/go-admin-core v1.3.11 @@ -9,4 +9,4 @@ require ( require go.uber.org/multierr v1.10.0 // indirect -replace github.com/go-admin-team/go-admin-core v1.3.11 => ../../../ +//replace github.com/go-admin-team/go-admin-core v1.3.11 => ../../../ diff --git a/sdk/go.mod b/sdk/go.mod index bae897e0..d9d94a24 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module github.com/go-admin-team/go-admin-core/sdk -go 1.20 +go 1.21 require ( github.com/bsm/redislock v0.9.4 @@ -24,7 +24,7 @@ require ( github.com/redis/go-redis/v9 v9.3.0 github.com/robfig/cron/v3 v3.0.1 github.com/shamsher31/goimgext v1.0.0 - github.com/slok/go-http-metrics v0.9.0 + github.com/slok/go-http-metrics v0.11.0 github.com/smartystreets/goconvey v1.8.1 golang.org/x/crypto v0.14.0 gorm.io/gorm v1.25.5 @@ -32,7 +32,7 @@ require ( require ( github.com/AlecAivazis/survey/v2 v2.3.6 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect + github.com/BurntSushi/toml v1.3.2 // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.0 // indirect @@ -56,14 +56,13 @@ require ( github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.15.4 // indirect - github.com/go-redis/redis/v9 v9.0.0-rc.1 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/golang/snappy v0.0.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/huandu/xstrings v1.3.3 // indirect @@ -85,10 +84,10 @@ require ( github.com/kyokomi/emoji/v2 v2.2.11 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect github.com/mattn/goveralls v0.0.12 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/microsoft/go-mssqldb v0.17.0 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect @@ -96,12 +95,12 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/nyaruka/phonenumbers v1.0.55 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.11.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.26.0 // indirect - github.com/prometheus/procfs v0.6.0 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shopspring/decimal v1.2.0 // indirect github.com/smarty/assertions v1.15.0 // indirect @@ -122,12 +121,12 @@ require ( golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/tools v0.8.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gorm.io/driver/mysql v1.4.4 // indirect diff --git a/sdk/pkg/casbin/log.go b/sdk/pkg/casbin/log.go index 6498c24d..ca774fed 100644 --- a/sdk/pkg/casbin/log.go +++ b/sdk/pkg/casbin/log.go @@ -1,9 +1,9 @@ package mycasbin import ( - "sync/atomic" - "github.com/go-admin-team/go-admin-core/logger" + "log/slog" + "sync/atomic" ) // Logger is the implementation for a Logger using golang log. @@ -11,6 +11,11 @@ type Logger struct { enable int32 } +func (l *Logger) LogError(err error, msg ...string) { + //TODO implement me + slog.Error(err.Error(), msg, err) +} + // EnableLog controls whether print the message. func (l *Logger) EnableLog(enable bool) { i := 0 From 12c7096145c6deed37b5a97d6233dc4418fb97fd Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 15:43:01 +0800 Subject: [PATCH 38/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20redis=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/config/locker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/config/locker.go b/sdk/config/locker.go index 5b1a335b..71a12d4c 100644 --- a/sdk/config/locker.go +++ b/sdk/config/locker.go @@ -3,7 +3,7 @@ package config import ( "github.com/go-admin-team/go-admin-core/storage" "github.com/go-admin-team/go-admin-core/storage/locker" - "github.com/go-redis/redis/v9" + "github.com/redis/go-redis/v9" ) var LockerConfig = new(Locker) From 5ffef8773dc5cff707f18c7f7a29d9f9a3ec7b5b Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 15:44:25 +0800 Subject: [PATCH 39/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E4=BE=9D=E8=B5=96=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/go.mod b/sdk/go.mod index d9d94a24..39266e74 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -118,7 +118,7 @@ require ( go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.13.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 // indirect + golang.org/x/image v0.1.0 // indirect golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect From ed33214df557dd7cb27bd6da1f4677d85a334f88 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 15:45:59 +0800 Subject: [PATCH 40/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/pkg/casbin/log.go | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/pkg/casbin/log.go b/sdk/pkg/casbin/log.go index ca774fed..b34e5b1f 100644 --- a/sdk/pkg/casbin/log.go +++ b/sdk/pkg/casbin/log.go @@ -12,7 +12,6 @@ type Logger struct { } func (l *Logger) LogError(err error, msg ...string) { - //TODO implement me slog.Error(err.Error(), msg, err) } From 856c36dae756dd537bcde4ad3b0c2040e345a712 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 16:24:19 +0800 Subject: [PATCH 41/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4core=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/logger/logrus/go.mod | 4 ++-- plugins/logger/zap/go.mod | 2 +- sdk/go.mod | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/logger/logrus/go.mod b/plugins/logger/logrus/go.mod index 68702e3e..8cff2def 100644 --- a/plugins/logger/logrus/go.mod +++ b/plugins/logger/logrus/go.mod @@ -3,10 +3,10 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/logrus go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.3.11 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 github.com/sirupsen/logrus v1.9.3 ) -require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect +require golang.org/x/sys v0.13.0 // indirect //replace github.com/go-admin-team/go-admin-core => ../../../ diff --git a/plugins/logger/zap/go.mod b/plugins/logger/zap/go.mod index 9981b6d8..96af557e 100644 --- a/plugins/logger/zap/go.mod +++ b/plugins/logger/zap/go.mod @@ -3,7 +3,7 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/zap go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.3.11 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 go.uber.org/zap v1.26.0 ) diff --git a/sdk/go.mod b/sdk/go.mod index 39266e74..62b3c8a2 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,7 +8,7 @@ require ( github.com/casbin/casbin/v2 v2.77.2 github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 - github.com/go-admin-team/go-admin-core v1.3.12-0.20221121065133-27b7dbe27a8f + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 @@ -41,22 +41,22 @@ require ( github.com/andeya/goutil v1.0.1 // indirect github.com/andygrunwald/go-jira v1.16.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bitly/go-simplejson v0.5.0 // indirect - github.com/bytedance/sonic v1.9.1 // indirect + github.com/bitly/go-simplejson v0.5.1 // indirect + github.com/bytedance/sonic v1.10.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chanxuehong/rand v0.0.0-20211009035549-2f07823e8e99 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/fatih/color v1.15.0 // indirect github.com/fatih/structs v1.1.0 // indirect - github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/git-chglog/git-chglog v0.15.4 // indirect - github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect @@ -104,7 +104,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shopspring/decimal v1.2.0 // indirect github.com/smarty/assertions v1.15.0 // indirect - github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cast v1.5.1 // indirect github.com/tidwall/gjson v1.14.4 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect @@ -118,7 +118,7 @@ require ( go.uber.org/multierr v1.5.0 // indirect go.uber.org/zap v1.13.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/image v0.1.0 // indirect + golang.org/x/image v0.11.0 // indirect golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect @@ -129,7 +129,7 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/driver/mysql v1.4.4 // indirect + gorm.io/driver/mysql v1.5.2 // indirect gorm.io/driver/postgres v1.4.5 // indirect gorm.io/driver/sqlite v1.4.3 // indirect gorm.io/driver/sqlserver v1.4.1 // indirect From 7e56a5d93b8410a548a62dd747bfde6a2d3c9bda Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 16:26:15 +0800 Subject: [PATCH 42/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4zap=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index 62b3c8a2..359a49fb 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -9,7 +9,7 @@ require ( github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 - github.com/go-admin-team/go-admin-core/plugins/logger/zap v0.0.0-20210610020726-2db73adb505d + github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103082419-856c36dae756 github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 github.com/go-admin-team/redisqueue/v2 v2.0.1-0.20231102124201-508101cc789a @@ -115,8 +115,8 @@ require ( github.com/urfave/cli/v2 v2.24.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect go.uber.org/atomic v1.6.0 // indirect - go.uber.org/multierr v1.5.0 // indirect - go.uber.org/zap v1.13.0 // indirect + go.uber.org/multierr v1.10.0 // indirect + go.uber.org/zap v1.26.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.11.0 // indirect golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect From 51f695cf90baa5348854e9814833aa28aff645da Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 16:36:00 +0800 Subject: [PATCH 43/59] =?UTF-8?q?fix=F0=9F=90=9B:=20=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/search/query.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/search/query.go b/tools/search/query.go index ff56f1ac..a3a5af26 100644 --- a/tools/search/query.go +++ b/tools/search/query.go @@ -34,10 +34,10 @@ func ResolveSearchQuery(driver string, q interface{}, condition Condition) { var ok bool var t *resolveSearchTag - var sep = "`" - if driver == Postgres { - sep = "\"" - } + //var sep = "`" + //if driver == Postgres { + // sep = "\"" + //} for i := 0; i < qType.NumField(); i++ { tag, ok = "", false From b8dcc949b86eb1fe7fc120dcf0278d302b9f2855 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 16:45:53 +0800 Subject: [PATCH 44/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4core=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/logger/logrus/go.mod | 2 +- plugins/logger/zap/go.mod | 2 +- sdk/go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/logger/logrus/go.mod b/plugins/logger/logrus/go.mod index 8cff2def..e62dd653 100644 --- a/plugins/logger/logrus/go.mod +++ b/plugins/logger/logrus/go.mod @@ -3,7 +3,7 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/logrus go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba github.com/sirupsen/logrus v1.9.3 ) diff --git a/plugins/logger/zap/go.mod b/plugins/logger/zap/go.mod index 96af557e..c0335957 100644 --- a/plugins/logger/zap/go.mod +++ b/plugins/logger/zap/go.mod @@ -3,7 +3,7 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/zap go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba go.uber.org/zap v1.26.0 ) diff --git a/sdk/go.mod b/sdk/go.mod index 359a49fb..1e4c5f9a 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,7 +8,7 @@ require ( github.com/casbin/casbin/v2 v2.77.2 github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103074559-ed33214df557 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103082419-856c36dae756 github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 From 110915f53e70f80531d699ae9087745f7deea9c8 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 16:48:18 +0800 Subject: [PATCH 45/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4log=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/go.mod b/sdk/go.mod index 1e4c5f9a..fa68af15 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -9,7 +9,7 @@ require ( github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba - github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103082419-856c36dae756 + github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103084621-a186c68d83c2 github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 github.com/go-admin-team/redisqueue/v2 v2.0.1-0.20231102124201-508101cc789a From 8c06ea121672466bff8af303a6921cfc6ac3e9cf Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 17:01:41 +0800 Subject: [PATCH 46/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 6 +++--- sdk/pkg/captcha/captcha.go | 12 ++++++------ sdk/pkg/captcha/store.go | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index fa68af15..2da88475 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -31,6 +31,7 @@ require ( ) require ( + dario.cat/mergo v1.0.0 // indirect github.com/AlecAivazis/survey/v2 v2.3.6 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect @@ -46,6 +47,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chanxuehong/rand v0.0.0-20211009035549-2f07823e8e99 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect + github.com/chenzhuoyu/iasm v0.9.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect @@ -87,7 +89,7 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect github.com/mattn/goveralls v0.0.12 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/microsoft/go-mssqldb v0.17.0 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect @@ -114,12 +116,10 @@ require ( github.com/ugorji/go/codec v1.2.11 // indirect github.com/urfave/cli/v2 v2.24.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - go.uber.org/atomic v1.6.0 // indirect go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.11.0 // indirect - golang.org/x/lint v0.0.0-20190930215403-16217165b5de // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect diff --git a/sdk/pkg/captcha/captcha.go b/sdk/pkg/captcha/captcha.go index af359e81..845a2577 100644 --- a/sdk/pkg/captcha/captcha.go +++ b/sdk/pkg/captcha/captcha.go @@ -12,7 +12,7 @@ func SetStore(s base64Captcha.Store) { base64Captcha.DefaultMemStore = s } -//configJsonBody json request body. +// configJsonBody json request body. type configJsonBody struct { Id string CaptchaType string @@ -27,10 +27,10 @@ type configJsonBody struct { func DriverStringFunc() (id, b64s string, err error) { e := configJsonBody{} e.Id = uuid.New().String() - e.DriverString = base64Captcha.NewDriverString(46, 140, 2, 2, 4, "234567890abcdefghjkmnpqrstuvwxyz", &color.RGBA{240, 240, 246, 246}, []string{"wqy-microhei.ttc"}) + e.DriverString = base64Captcha.NewDriverString(46, 140, 2, 2, 4, "234567890abcdefghjkmnpqrstuvwxyz", &color.RGBA{240, 240, 246, 246}, nil, []string{"wqy-microhei.ttc"}) driver := e.DriverString.ConvertFonts() - cap := base64Captcha.NewCaptcha(driver, base64Captcha.DefaultMemStore) - return cap.Generate() + captcha := base64Captcha.NewCaptcha(driver, base64Captcha.DefaultMemStore) + return captcha.Generate() } func DriverDigitFunc() (id, b64s string, err error) { @@ -38,8 +38,8 @@ func DriverDigitFunc() (id, b64s string, err error) { e.Id = uuid.New().String() e.DriverDigit = base64Captcha.NewDriverDigit(80, 240, 4, 0.7, 80) driver := e.DriverDigit - cap := base64Captcha.NewCaptcha(driver, base64Captcha.DefaultMemStore) - return cap.Generate() + captcha := base64Captcha.NewCaptcha(driver, base64Captcha.DefaultMemStore) + return captcha.Generate() } // Verify 校验验证码 diff --git a/sdk/pkg/captcha/store.go b/sdk/pkg/captcha/store.go index 707b1d4e..15142fe5 100644 --- a/sdk/pkg/captcha/store.go +++ b/sdk/pkg/captcha/store.go @@ -21,8 +21,8 @@ func NewCacheStore(cache storage.AdapterCache, expiration int) base64Captcha.Sto } // Set sets the digits for the captcha id. -func (e *cacheStore) Set(id string, value string) { - _ = e.cache.Set(id, value, e.expiration) +func (e *cacheStore) Set(id string, value string) error { + return e.cache.Set(id, value, e.expiration) } // Get returns stored digits for the captcha id. Clear indicates @@ -38,7 +38,7 @@ func (e *cacheStore) Get(id string, clear bool) string { return "" } -//Verify captcha's answer directly +// Verify captcha's answer directly func (e *cacheStore) Verify(id, answer string, clear bool) bool { return e.Get(id, clear) == answer } From 0314b1f6b3cccac5d1598eac75e8a11c7d8ef846 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 18:38:49 +0800 Subject: [PATCH 47/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=BB=98=E8=AE=A4=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=BB=A5MB=E4=B8=BA=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug/writer/file.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/debug/writer/file.go b/debug/writer/file.go index 2821ceaa..fed01c2e 100644 --- a/debug/writer/file.go +++ b/debug/writer/file.go @@ -79,7 +79,7 @@ func (p *FileWriter) write() { func (p *FileWriter) checkFile() { info, _ := p.file.Stat() if strings.Index(p.file.Name(), time.Now().Format(timeFormat)) < 0 || - (p.opts.cap > 0 && uint(info.Size()) > p.opts.cap) { + (p.opts.cap > 0 && uint(info.Size()) > p.opts.cap*1024*1024) { //生成新文件 if uint(info.Size()) > p.opts.cap { p.num++ @@ -91,7 +91,6 @@ func (p *FileWriter) checkFile() { p.file, _ = os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_SYNC, 0600) dir := filepath.Dir(p.file.Name()) - fmt.Println("File directory:", dir) files, err := ioutil.ReadDir(dir) if err != nil { fmt.Println("Error reading log directory:", err) From 03736a0f7691438aaff01df4b9cb51059fbf713f Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 18:39:12 +0800 Subject: [PATCH 48/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=BB=98=E8=AE=A4=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=BB=A5MB=E4=B8=BA=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug/writer/file.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/writer/file.go b/debug/writer/file.go index fed01c2e..a9d44a0e 100644 --- a/debug/writer/file.go +++ b/debug/writer/file.go @@ -81,7 +81,7 @@ func (p *FileWriter) checkFile() { if strings.Index(p.file.Name(), time.Now().Format(timeFormat)) < 0 || (p.opts.cap > 0 && uint(info.Size()) > p.opts.cap*1024*1024) { //生成新文件 - if uint(info.Size()) > p.opts.cap { + if uint(info.Size()) > p.opts.cap*1024*1024 { p.num++ } else { p.num = 0 From 82b086d9e2c1cc55ffba15f036c4a3a639ce5dd0 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 18:48:27 +0800 Subject: [PATCH 49/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=BB=98=E8=AE=A4=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=BB=A5MB=E4=B8=BA=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debug/writer/file.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/debug/writer/file.go b/debug/writer/file.go index a9d44a0e..2a8bb8ed 100644 --- a/debug/writer/file.go +++ b/debug/writer/file.go @@ -3,7 +3,6 @@ package writer import ( "errors" "fmt" - "io/ioutil" "log" "os" "path/filepath" @@ -15,6 +14,8 @@ import ( // 用于文件名称格式 const timeFormat = "2006-01-02" +const MB = 1024 * 1024 + // FileWriter 文件写入结构体 type FileWriter struct { file *os.File @@ -79,9 +80,9 @@ func (p *FileWriter) write() { func (p *FileWriter) checkFile() { info, _ := p.file.Stat() if strings.Index(p.file.Name(), time.Now().Format(timeFormat)) < 0 || - (p.opts.cap > 0 && uint(info.Size()) > p.opts.cap*1024*1024) { + (p.opts.cap > 0 && uint(info.Size()) > p.opts.cap*MB) { //生成新文件 - if uint(info.Size()) > p.opts.cap*1024*1024 { + if uint(info.Size()) > p.opts.cap*MB { p.num++ } else { p.num = 0 @@ -91,7 +92,7 @@ func (p *FileWriter) checkFile() { p.file, _ = os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_SYNC, 0600) dir := filepath.Dir(p.file.Name()) - files, err := ioutil.ReadDir(dir) + files, err := os.ReadDir(dir) if err != nil { fmt.Println("Error reading log directory:", err) return @@ -100,7 +101,12 @@ func (p *FileWriter) checkFile() { for _, file := range files { if !file.IsDir() && strings.HasSuffix(file.Name(), p.opts.suffix) { filePath := filepath.Join(dir, file.Name()) - fileModTime := file.ModTime() + fileInfo, err := file.Info() + if err != nil { + fmt.Println("Error get Info file:", err) + break + } + fileModTime := fileInfo.ModTime() daysSinceMod := uint(time.Since(fileModTime).Hours() / 24) if daysSinceMod > p.opts.daysToKeep { err := os.Remove(filePath) From 2d9e40ec6f715f492c95393bb45fa33d33e2e4e3 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 18:51:42 +0800 Subject: [PATCH 50/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=97=A5=E5=BF=97=E7=BB=84=E4=BB=B6gomod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/logger/logrus/go.mod | 2 +- plugins/logger/zap/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/logger/logrus/go.mod b/plugins/logger/logrus/go.mod index e62dd653..a4b0d629 100644 --- a/plugins/logger/logrus/go.mod +++ b/plugins/logger/logrus/go.mod @@ -3,7 +3,7 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/logrus go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103104827-82b086d9e2c1 github.com/sirupsen/logrus v1.9.3 ) diff --git a/plugins/logger/zap/go.mod b/plugins/logger/zap/go.mod index c0335957..7d3905a5 100644 --- a/plugins/logger/zap/go.mod +++ b/plugins/logger/zap/go.mod @@ -3,7 +3,7 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/zap go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103104827-82b086d9e2c1 go.uber.org/zap v1.26.0 ) From 84418ed9252cf12f31ef7670aea7af341b38ba32 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Fri, 3 Nov 2023 18:53:56 +0800 Subject: [PATCH 51/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7sdk=20gomod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index 2da88475..9fc6253c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/casbin/casbin/v2 v2.77.2 github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103083600-51f695cf90ba - github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103084621-a186c68d83c2 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231103105142-2d9e40ec6f71 + github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103105142-2d9e40ec6f71 github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 github.com/go-admin-team/redisqueue/v2 v2.0.1-0.20231102124201-508101cc789a From 1f91355a5ba5d23c1b59e72e5c5d24c5a81dd379 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Mon, 18 Dec 2023 11:35:32 +0800 Subject: [PATCH 52/59] log update --- logger/default.go | 6 +++++- logger/options.go | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/logger/default.go b/logger/default.go index b595eb35..ec2eea1b 100644 --- a/logger/default.go +++ b/logger/default.go @@ -134,7 +134,11 @@ func (l *defaultLogger) logf(level Level, format string, v ...interface{}) { if l.opts.Name != "" { name = "[" + l.opts.Name + "]" } - t := rec.Timestamp.Format("2006-01-02 15:04:05.000Z0700") + timeFormat := "2006-01-02 15:04:05" + if l.opts.TimeFormat != "" { + timeFormat = l.opts.TimeFormat + } + t := rec.Timestamp.Format(timeFormat) logStr := "" if name == "" { logStr = fmt.Sprintf("%s %s %v\n", t, metadata, rec.Message) diff --git a/logger/options.go b/logger/options.go index edfc41ce..dcfbfa0a 100644 --- a/logger/options.go +++ b/logger/options.go @@ -20,6 +20,8 @@ type Options struct { Context context.Context // Name logger name Name string + // Timestamp.Format + TimeFormat string } // WithFields set default fields for the logger @@ -29,6 +31,12 @@ func WithFields(fields map[string]interface{}) Option { } } +func RemoveFieldByKey(key string) Option { + return func(args *Options) { + delete(args.Fields, key) + } +} + // WithLevel set default level for the logger func WithLevel(level Level) Option { return func(args *Options) { @@ -57,6 +65,13 @@ func WithName(name string) Option { } } +// WithTimeFormat set time format for logger eg. 2006-01-02 15:04:05.000Z0700 +func WithTimeFormat(TimeFormat string) Option { + return func(args *Options) { + args.TimeFormat = TimeFormat + } +} + func SetOption(k, v interface{}) Option { return func(o *Options) { if o.Context == nil { From a2e7e75321d0739ff70e7f0d2867b4a1ea8faa5a Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Wed, 27 Dec 2023 22:57:03 +0800 Subject: [PATCH 53/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0gorm=E6=97=A5=E5=BF=97=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/gorm/logger/logger.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/gorm/logger/logger.go b/tools/gorm/logger/logger.go index 7964dc55..d578c453 100644 --- a/tools/gorm/logger/logger.go +++ b/tools/gorm/logger/logger.go @@ -138,18 +138,18 @@ func New(config logger.Config) logger.Interface { infoStr = "%s\n[info] " warnStr = "%s\n[warn] " errStr = "%s\n[error] " - traceStr = "%s [%.3fms] [rows:%v] %s" - traceWarnStr = "%s %s [%.3fms] [rows:%v] %s" - traceErrStr = "%s %s [%.3fms] [rows:%v] %s" + traceStr = "%s\n[%.3fms] [rows:%v] %s\n" + traceWarnStr = "%s %s\n[%.3fms] [rows:%v] %s\n" + traceErrStr = "%s %s\n[%.3fms] [rows:%v] %s\n" ) if config.Colorful { - infoStr = Green + "%s " + Reset + Green + "[info] " + Reset - warnStr = BlueBold + "%s " + Reset + Magenta + "[warn] " + Reset - errStr = Magenta + "%s " + Reset + Red + "[error] " + Reset - traceStr = Green + "%s " + Reset + Yellow + "[%.3fms] " + BlueBold + "[rows:%v]" + Reset + " %s" - traceWarnStr = Green + "%s " + Yellow + "%s " + Reset + RedBold + "[%.3fms] " + Yellow + "[rows:%v]" + Magenta + " %s" + Reset - traceErrStr = RedBold + "%s " + MagentaBold + "%s " + Reset + Yellow + "[%.3fms] " + BlueBold + "[rows:%v]" + Reset + " %s" + infoStr = Green + "%s\n" + Reset + Green + "[info] " + Reset + warnStr = BlueBold + "%s\n" + Reset + Magenta + "[warn] " + Reset + errStr = Magenta + "%s\n" + Reset + Red + "[error] " + Reset + traceStr = Green + "%s\n" + Reset + Yellow + "[%.3fms] " + BlueBold + "[rows:%v]" + Reset + " %s\n" + traceWarnStr = Green + "%s " + Yellow + "%s\n" + Reset + RedBold + "[%.3fms] " + Yellow + "[rows:%v]" + Magenta + " %s" + Reset + traceErrStr = RedBold + "%s " + MagentaBold + "%s\n" + Reset + Yellow + "[%.3fms] " + BlueBold + "[rows:%v]" + Reset + " %s" } return &gormLogger{ From 797ba969c20d8842a2963fae1053a03a318ff6e8 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Wed, 27 Dec 2023 22:58:10 +0800 Subject: [PATCH 54/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0NewSheet=20=E8=BF=94=E5=9B=9E=E5=80=BC=E5=BF=BD?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/utils/excel.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/utils/excel.go b/tools/utils/excel.go index 49e9db26..2e037aa7 100644 --- a/tools/utils/excel.go +++ b/tools/utils/excel.go @@ -11,9 +11,9 @@ var Cols = []string{"", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", " // WriteXlsx 填充excel func WriteXlsx(sheet string, records interface{}) *excelize.File { - xlsx := excelize.NewFile() // new file - index := xlsx.NewSheet(sheet) // new sheet - xlsx.SetActiveSheet(index) // set active (default) sheet + xlsx := excelize.NewFile() // new file + index, _ := xlsx.NewSheet(sheet) // new sheet + xlsx.SetActiveSheet(index) // set active (default) sheet t := reflect.TypeOf(records) if t.Kind() != reflect.Slice { From 435d380148f752bf14d52911e122d41a09a10a17 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Wed, 27 Dec 2023 23:16:23 +0800 Subject: [PATCH 55/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BE=9D=E8=B5=96=E5=BA=93=E7=89=88=E6=9C=ACgithub.co?= =?UTF-8?q?m/mojocn/base64Captcha=201.3.5=E3=80=8B1.3.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index b10fef79..2c54552b 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,7 +8,7 @@ require ( github.com/casbin/casbin/v2 v2.77.2 github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103105142-2d9e40ec6f71 + github.com/go-admin-team/go-admin-core v1.5.2-0.20231227145810-797ba969c20d github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103105142-2d9e40ec6f71 github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 @@ -19,7 +19,7 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 github.com/google/uuid v1.4.0 github.com/gorilla/websocket v1.5.0 - github.com/mojocn/base64Captcha v1.3.5 + github.com/mojocn/base64Captcha v1.3.6 github.com/nsqio/go-nsq v1.1.0 github.com/redis/go-redis/v9 v9.3.0 github.com/robfig/cron/v3 v3.0.1 @@ -117,7 +117,7 @@ require ( go.uber.org/multierr v1.10.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/image v0.11.0 // indirect + golang.org/x/image v0.13.0 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect From 099aab3dec024534e0b9ad2c77d01c0f7f649fc6 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Wed, 3 Jan 2024 09:28:41 +0800 Subject: [PATCH 56/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0uuid=20=E5=92=8Credis=20=E4=BE=9D=E8=B5=96=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 81fac22c..e968b8dc 100644 --- a/go.mod +++ b/go.mod @@ -12,14 +12,14 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/go-admin-team/redisqueue/v2 v2.0.0 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.5.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/json-iterator/go v1.1.12 github.com/nsqio/go-nsq v1.1.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 - github.com/redis/go-redis/v9 v9.3.0 + github.com/redis/go-redis/v9 v9.3.1 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/smartystreets/goconvey v1.8.1 github.com/spf13/cast v1.5.1 From c1dec45c44c4e3e2fe1f3d3139f68e1f6cc74280 Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Wed, 3 Jan 2024 12:54:15 +0800 Subject: [PATCH 57/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E7=9A=84=E9=AA=8C=E8=AF=81=E7=A0=81=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/pkg/captcha/captcha.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/pkg/captcha/captcha.go b/sdk/pkg/captcha/captcha.go index 845a2577..491fcc5b 100644 --- a/sdk/pkg/captcha/captcha.go +++ b/sdk/pkg/captcha/captcha.go @@ -24,7 +24,7 @@ type configJsonBody struct { DriverDigit *base64Captcha.DriverDigit } -func DriverStringFunc() (id, b64s string, err error) { +func DriverStringFunc() (id, b64s, answer string, err error) { e := configJsonBody{} e.Id = uuid.New().String() e.DriverString = base64Captcha.NewDriverString(46, 140, 2, 2, 4, "234567890abcdefghjkmnpqrstuvwxyz", &color.RGBA{240, 240, 246, 246}, nil, []string{"wqy-microhei.ttc"}) @@ -33,7 +33,7 @@ func DriverStringFunc() (id, b64s string, err error) { return captcha.Generate() } -func DriverDigitFunc() (id, b64s string, err error) { +func DriverDigitFunc() (id, b64s, answer string, err error) { e := configJsonBody{} e.Id = uuid.New().String() e.DriverDigit = base64Captcha.NewDriverDigit(80, 240, 4, 0.7, 80) From 1f0a697d52b41c5639f0d9c7c5eff7bb2061ff1e Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Mon, 8 Jan 2024 21:56:26 +0800 Subject: [PATCH 58/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0go-admin-core=E4=BE=9D=E8=B5=96=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/logger/logrus/go.mod | 4 ++-- plugins/logger/zap/go.mod | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/logger/logrus/go.mod b/plugins/logger/logrus/go.mod index a4b0d629..5490be74 100644 --- a/plugins/logger/logrus/go.mod +++ b/plugins/logger/logrus/go.mod @@ -3,10 +3,10 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/logrus go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103104827-82b086d9e2c1 + github.com/go-admin-team/go-admin-core v1.5.2 github.com/sirupsen/logrus v1.9.3 ) -require golang.org/x/sys v0.13.0 // indirect +require golang.org/x/sys v0.15.0 // indirect //replace github.com/go-admin-team/go-admin-core => ../../../ diff --git a/plugins/logger/zap/go.mod b/plugins/logger/zap/go.mod index 7d3905a5..91daca07 100644 --- a/plugins/logger/zap/go.mod +++ b/plugins/logger/zap/go.mod @@ -3,10 +3,10 @@ module github.com/go-admin-team/go-admin-core/plugins/logger/zap go 1.21 require ( - github.com/go-admin-team/go-admin-core v1.5.2-0.20231103104827-82b086d9e2c1 + github.com/go-admin-team/go-admin-core v1.5.2 go.uber.org/zap v1.26.0 ) -require go.uber.org/multierr v1.10.0 // indirect +require go.uber.org/multierr v1.11.0 // indirect //replace github.com/go-admin-team/go-admin-core v1.3.11 => ../../../ From fbbcd03bac4a388c5f420e0e242464cc702cbb9f Mon Sep 17 00:00:00 2001 From: wenjianzhang Date: Mon, 8 Jan 2024 22:09:55 +0800 Subject: [PATCH 59/59] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0go-admin-core=20&=20log=E4=BE=9D=E8=B5=96=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/go.mod | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sdk/go.mod b/sdk/go.mod index 2c54552b..6287107a 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -5,11 +5,11 @@ go 1.21 require ( github.com/bsm/redislock v0.9.4 github.com/bytedance/go-tagexpr/v2 v2.9.11 - github.com/casbin/casbin/v2 v2.77.2 + github.com/casbin/casbin/v2 v2.80.0 github.com/chanxuehong/wechat v0.0.0-20230222024006-36f0325263cd github.com/gin-gonic/gin v1.9.1 - github.com/go-admin-team/go-admin-core v1.5.2-0.20231227145810-797ba969c20d - github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.3.5-rc.0.0.20231103105142-2d9e40ec6f71 + github.com/go-admin-team/go-admin-core v1.5.2 + github.com/go-admin-team/go-admin-core/plugins/logger/zap v1.5.2 github.com/go-admin-team/gorm-adapter/v3 v3.2.1-0.20210902112335-4148cb356a24 github.com/go-admin-team/redis-watcher/v2 v2.0.0-20231102130416-bfe327cac940 github.com/go-admin-team/redisqueue/v2 v2.0.1-0.20231102124201-508101cc789a @@ -17,11 +17,11 @@ require ( github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.15.5 github.com/golang-jwt/jwt/v4 v4.5.0 - github.com/google/uuid v1.4.0 + github.com/google/uuid v1.5.0 github.com/gorilla/websocket v1.5.0 github.com/mojocn/base64Captcha v1.3.6 github.com/nsqio/go-nsq v1.1.0 - github.com/redis/go-redis/v9 v9.3.0 + github.com/redis/go-redis/v9 v9.3.1 github.com/robfig/cron/v3 v3.0.1 github.com/shamsher31/goimgext v1.0.0 github.com/slok/go-http-metrics v0.11.0 @@ -34,7 +34,6 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/AlecAivazis/survey/v2 v2.3.6 // indirect github.com/BurntSushi/toml v1.3.2 // indirect - github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.2.0 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect @@ -44,6 +43,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bitly/go-simplejson v0.5.1 // indirect github.com/bytedance/sonic v1.10.2 // indirect + github.com/casbin/govaluate v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chanxuehong/rand v0.0.0-20211009035549-2f07823e8e99 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect @@ -73,8 +73,10 @@ require ( github.com/jackc/pgconn v1.13.0 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.1 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgx/v5 v5.3.0 // indirect + github.com/jackc/pgtype v1.12.0 // indirect + github.com/jackc/pgx/v4 v4.17.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -105,16 +107,13 @@ require ( github.com/shopspring/decimal v1.2.0 // indirect github.com/smarty/assertions v1.15.0 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/tidwall/gjson v1.14.4 // indirect - github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect github.com/trivago/tgo v1.0.7 // indirect github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect github.com/urfave/cli/v2 v2.24.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - go.uber.org/multierr v1.10.0 // indirect + go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/image v0.13.0 // indirect