From 9f8eb65c98ad7c004cd047cf7c088b567e0f9351 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Tue, 3 Dec 2024 10:50:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/backend/cmd_controller.go | 6 + app/http/entities/backend/cmd.go | 4 + app/http/requestmapping/backend.go | 13 +- app/http/routes/admin.go | 1 + app/services/cmd_service/cmd_service.go | 40 ++++ app/utils/excute/dbExecute.go | 214 ++++++++++++++++++ app/utils/excute/gorm.go | 38 ++++ app/utils/excute/types.go | 33 +++ app/utils/util.go | 10 + go.mod | 13 +- go.sum | 35 ++- 11 files changed, 372 insertions(+), 35 deletions(-) create mode 100644 app/utils/excute/dbExecute.go create mode 100644 app/utils/excute/gorm.go create mode 100644 app/utils/excute/types.go diff --git a/app/http/controllers/backend/cmd_controller.go b/app/http/controllers/backend/cmd_controller.go index a2532ac..7ed88d0 100644 --- a/app/http/controllers/backend/cmd_controller.go +++ b/app/http/controllers/backend/cmd_controller.go @@ -48,3 +48,9 @@ func CmdStart(c *gin.Context) { err := cmd_services.Start(request) controllers.HandRes(c, nil, err) } + +func CmdTestRead(c *gin.Context) { + request := controllers.GetRequest(c).(*backend.CmdTestRequest) + result, time_duration, err := cmd_services.TestRead(request) + controllers.HandRes(c, gin.H{"result": result, "time_duration": time_duration}, err) +} diff --git a/app/http/entities/backend/cmd.go b/app/http/entities/backend/cmd.go index 9f9d207..b61dda4 100644 --- a/app/http/entities/backend/cmd.go +++ b/app/http/entities/backend/cmd.go @@ -87,6 +87,10 @@ type CmdStartRequest struct { CmdId int `json:"cmd_id" validate:"required" form:"cmd_id" example:""` } +type CmdTestRequest struct { + CmdId int `json:"cmd_id" validate:"required" form:"cmd_id" example:""` +} + type CmdStopRequest struct { CmdId int `json:"cmd_id" validate:"required" form:"cmd_id" example:""` } diff --git a/app/http/requestmapping/backend.go b/app/http/requestmapping/backend.go index ded07cd..c512bc9 100644 --- a/app/http/requestmapping/backend.go +++ b/app/http/requestmapping/backend.go @@ -38,10 +38,11 @@ var BackendRequestMap = map[string]func() interface{}{ common.ADMIN_OAUTH_V1 + "/log/mes/list": func() interface{} { return new(backend.CronReportLogsListRequest) }, //任务 - common.ADMIN_OAUTH_V1 + "/cmd/list": func() interface{} { return new(backend.CmdListRequest) }, - common.ADMIN_OAUTH_V1 + "/cmd/add": func() interface{} { return new(backend.CmdAddRequest) }, - common.ADMIN_OAUTH_V1 + "/cmd/edit": func() interface{} { return new(backend.CmdEditRequest) }, - common.ADMIN_OAUTH_V1 + "/cmd/del": func() interface{} { return new(backend.CmdDeleteRequest) }, - common.ADMIN_OAUTH_V1 + "/cmd/start": func() interface{} { return new(backend.CmdStartRequest) }, - common.ADMIN_OAUTH_V1 + "/cmd/stop": func() interface{} { return new(backend.CmdStopRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/list": func() interface{} { return new(backend.CmdListRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/add": func() interface{} { return new(backend.CmdAddRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/edit": func() interface{} { return new(backend.CmdEditRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/del": func() interface{} { return new(backend.CmdDeleteRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/start": func() interface{} { return new(backend.CmdStartRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/stop": func() interface{} { return new(backend.CmdStopRequest) }, + common.ADMIN_OAUTH_V1 + "/cmd/test/read": func() interface{} { return new(backend.CmdTestRequest) }, } diff --git a/app/http/routes/admin.go b/app/http/routes/admin.go index a347dfa..34d1a38 100644 --- a/app/http/routes/admin.go +++ b/app/http/routes/admin.go @@ -55,6 +55,7 @@ func RegisterAdminRoute(router *gin.Engine) { cmd.DELETE("/del", backend.CmdDel) cmd.POST("/start", backend.CmdStart) cmd.POST("/stop", backend.CmdStop) + cmd.POST("/test/read", backend.CmdTestRead) } //消息管理 mes := v1.Group("/channel") diff --git a/app/services/cmd_service/cmd_service.go b/app/services/cmd_service/cmd_service.go index 7c6f532..36067c1 100644 --- a/app/services/cmd_service/cmd_service.go +++ b/app/services/cmd_service/cmd_service.go @@ -8,11 +8,13 @@ import ( "cron_admin/app/models/cronreportchannelmodel" "cron_admin/app/models/cronusermodel" "cron_admin/app/repository" + "cron_admin/app/utils/excute" "cron_admin/app/utils/mapstructure" "fmt" "github.com/ahmetb/go-linq/v3" "strconv" "strings" + "time" "xorm.io/builder" ) @@ -106,6 +108,44 @@ func Stop(request *backend.CmdStopRequest) (err error) { return } +func TestRead(request *backend.CmdTestRequest) (result interface{}, time_duration float64, err error) { + var ( + data croncmdmodel.CronCmd + database crondbmodel.CronDb + ) + exists, err := croncmdmodel.GetInstance().GetDb().ID(request.CmdId).Get(&data) + if !exists { + return nil, 0, fmt.Errorf("数据不存在") + } + if err != nil { + return + } + exists, err = crondbmodel.GetInstance().GetDb().ID(data.ReadDbId).Get(&database) + if !exists { + return nil, 0, fmt.Errorf("数据库不存在") + } + if err != nil { + return + } + //执行 + start := time.Now() + db, err := excute.NewExecuteDb(database.Source, database.DbName) + if err != nil { + return nil, 0, err + } + result, err = db.ExecuteRead(data.ExecuteRead) + if err != nil { + return result, 0, err + } + // 记录结束时间 + end := time.Now() + + // 计算执行时间 + duration := end.Sub(start) + time_duration = duration.Seconds() + return +} + func ListToRep(list []croncmdmodel.CronCmd) (cmdList []backend.CmdListResponse, err error) { var ( userIdList []int diff --git a/app/utils/excute/dbExecute.go b/app/utils/excute/dbExecute.go new file mode 100644 index 0000000..2985775 --- /dev/null +++ b/app/utils/excute/dbExecute.go @@ -0,0 +1,214 @@ +package excute + +import ( + "cron_admin/app/utils" + "encoding/json" + "fmt" + "github.com/jinzhu/copier" + "gorm.io/gorm" + "strings" + "time" +) + +type ExecuteDb struct { + Db *gorm.DB + DbName string +} + +func NewExecuteDb(source string, dbName string) (*ExecuteDb, error) { + db, err := ExecuteDbConn(source) + if err != nil { + return nil, fmt.Errorf("%s链接失败:%v", dbName, err) + } + return &ExecuteDb{Db: db, DbName: dbName}, nil +} + +func (db *ExecuteDb) ExecuteRead(execute string) (result []map[string]interface{}, err error) { + rows, err := db.Db.Raw(execute).Rows() + if err != nil { + return nil, fmt.Errorf("数据执行失败:%v", err.Error()) + } + defer rows.Close() + for rows.Next() { + err = db.Db.ScanRows(rows, &result) + if err != nil { + return nil, fmt.Errorf("数据映射失败:%v", err) + } + } + + return result, nil +} + +func (db *ExecuteDb) ExecuteWriteV2(readData []map[string]interface{}, execute string) (dbString string, err error) { + var ( + dbExecuteSql []string + ) + for _, v := range readData { + dbExecuteSql = append(dbExecuteSql, db.replaceExecuteString(execute, v)) + } + dbString = strings.Join(dbExecuteSql, ";") + for _, v := range dbExecuteSql { + d := db.Db.Exec(v) + if d.Error != nil { + return dbString, d.Error + } + } + return dbString, nil +} + +func (db *ExecuteDb) replaceExecuteString(execute string, rowData map[string]interface{}) string { + executeString := execute + for key, value := range rowData { + key := fmt.Sprintf("${%s}", key) + executeString = strings.Replace(executeString, key, fmt.Sprintf("%v", value), -1) + } + return executeString +} + +func (db *ExecuteDb) ExecuteWriteV1(readData []map[string]interface{}, execute string) (err error) { + var ( + match MatchWrite + ) + err = json.Unmarshal([]byte(execute), &match) + if err != nil { + return fmt.Errorf("写执行命令数据格式验证失败:%v", err) + } + table, err := db.GetTableColumnsInfo(match.Table) + if err != nil { + return err + } + switch match.Op { + case "insert": + insertData := db.ForInsert(&table, readData, match.Data) + db.Db.Table(match.Table).Create(insertData) + case "update": + for _, v := range readData { + updateData, updateKey := db.ForUpdate(&table, v, match.Data, match.Keys) + db.Db.Table(match.Table).Where(updateKey).Updates(updateData) + } + default: + return fmt.Errorf("未知的写操作执行类型:%v", match.Op) + } + + return nil +} + +func (db *ExecuteDb) GetTableColumnsInfo(tableName string) (tableInfo []TableColumn, err error) { + column, _ := db.Db.Raw(fmt.Sprintf("SHOW FULL COLUMNS FROM `%s`", tableName)).Rows() + defer column.Close() + for column.Next() { + err := db.Db.ScanRows(column, &tableInfo) + if err != nil { + return tableInfo, fmt.Errorf("获取表结构失败:%v", err) + } + } + return tableInfo, nil +} + +func (db *ExecuteDb) ForInsert(table *[]TableColumn, resultData []map[string]interface{}, matchData string) (insertData []map[string]interface{}) { + var ( + columns = map[string]interface{}{} + mData []string + ) + if matchData != "" { + mData = strings.Split(matchData, ",") + } + for _, v := range *table { + in := false + if v.Key == "PRI" && v.Extra == "auto_increment" { + continue + } + col := NotNullColumnDefault{} + if v.Null == "NO" && v.Default.(*interface{}) == nil { //非null的情况 + //处理非null但是default为空的情况 + if strings.Contains(v.Type, "time") { + col.Default = time.Now().Format(time.DateTime) + } else if strings.Contains(v.Type, "int") { + col.Default = 0 + } else if strings.Contains(v.Type, "json") { + col.Default = "{}" + } else { + col.Default = "" + } + in = true + } else { + //null的情况 + if len(mData) != 0 { + if utils.ContainsStr(mData, v.Field) { + in = true + } + } else { + in = true + } + } + if in { + col.Field = v.Field + columns[col.Field] = col.Default + } + } + + for _, v := range resultData { + var row map[string]interface{} + copier.Copy(&row, columns) + for key, value := range v { + if _, ok := columns[key]; ok { + row[key] = value + } + } + insertData = append(insertData, row) + } + return insertData +} + +func (db *ExecuteDb) ForUpdate(table *[]TableColumn, resultData map[string]interface{}, matchData string, matchKeys string) (updateData map[string]interface{}, updateKeys map[string]interface{}) { + var ( + columns []string + mData []string + primary PrimaryKey + keys []string + ) + if matchData != "" { + mData = strings.Split(matchData, ",") + } + if matchKeys != "" { + keys = strings.Split(matchKeys, ",") + } + for _, v := range *table { + in := false + if v.Key == "PRI" && len(keys) == 0 { + primary.Filed = v.Field + continue + } + if len(mData) != 0 { + if utils.ContainsStr(mData, v.Field) { + in = true + } + } else { + in = true + } + if in { + columns = append(columns, v.Field) + } + } + updateData = map[string]interface{}{} + updateKeys = map[string]interface{}{} + for key, value := range resultData { + if key == primary.Filed { + primary.FiledValue = value + continue + } + if utils.ContainsStr(keys, key) { + updateKeys[key] = value + continue + } + if utils.ContainsStr(columns, key) { + updateData[key] = value + } + } + + if len(updateKeys) == 0 && primary.FiledValue != nil { + updateKeys[primary.Filed] = primary.FiledValue + } + + return updateData, updateKeys +} diff --git a/app/utils/excute/gorm.go b/app/utils/excute/gorm.go new file mode 100644 index 0000000..8a09352 --- /dev/null +++ b/app/utils/excute/gorm.go @@ -0,0 +1,38 @@ +package excute + +import ( + "fmt" + "gorm.io/driver/mysql" + "gorm.io/gorm" + "gorm.io/gorm/schema" +) + +func NewDb(str string) (*gorm.DB, error) { + db, err := gorm.Open( + mysql.Open(str+""), + &gorm.Config{ + NamingStrategy: schema.NamingStrategy{SingularTable: true}, + }, + ) + if err != nil { + return nil, fmt.Errorf("数据库连接失败,%v", err.Error()) + } + db = db.Debug() + sqlDB, _ := db.DB() + sqlDB.SetMaxIdleConns(2) //设置连接池,空闲 + return db, nil +} + +func ExecuteDbConn(str string) (*gorm.DB, error) { + db, err := gorm.Open( + mysql.Open(str+""), + &gorm.Config{ + NamingStrategy: schema.NamingStrategy{SingularTable: true}, + }, + ) + if err != nil { + return nil, fmt.Errorf("数据库连接失败,%v", err.Error()) + } + db = db.Debug() + return db, nil +} diff --git a/app/utils/excute/types.go b/app/utils/excute/types.go new file mode 100644 index 0000000..3479b65 --- /dev/null +++ b/app/utils/excute/types.go @@ -0,0 +1,33 @@ +package excute + +type Match struct { + Key string `json:"key"` + Op string `json:"op"` + Val interface{} `json:"val"` +} + +type MatchWrite struct { + Table string `json:"table"` + Op string `json:"op"` + Data string `json:"data"` + Keys string `json:"keys"` +} + +type PrimaryKey struct { + Filed string + FiledValue interface{} +} + +type TableColumn struct { + Field string + Null string + Default interface{} + Key string + Extra string + Type string +} + +type NotNullColumnDefault struct { + Field string + Default interface{} +} diff --git a/app/utils/util.go b/app/utils/util.go index a163ea4..c96d6c2 100644 --- a/app/utils/util.go +++ b/app/utils/util.go @@ -466,3 +466,13 @@ func SnakeToCamel(s string) string { return camelCase } + +// ContainsStr 切片中是否存在某个字符串 +func ContainsStr(slice []string, element string) bool { + for _, v := range slice { + if v == element { + return true + } + } + return false +} diff --git a/go.mod b/go.mod index e39aeae..75c45cf 100644 --- a/go.mod +++ b/go.mod @@ -15,9 +15,10 @@ require ( github.com/go-kratos/kratos/v2 v2.8.2 github.com/go-playground/locales v0.14.0 github.com/go-playground/universal-translator v0.18.0 - github.com/go-sql-driver/mysql v1.6.0 + github.com/go-sql-driver/mysql v1.7.0 github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang/protobuf v1.5.4 + github.com/jinzhu/copier v0.4.0 github.com/nacos-group/nacos-sdk-go/v2 v2.2.5 github.com/nats-io/nats.go v1.9.1 github.com/openzipkin/zipkin-go v0.2.2 @@ -35,6 +36,8 @@ require ( google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.33.0 gopkg.in/go-playground/validator.v9 v9.31.0 + gorm.io/driver/mysql v1.5.7 + gorm.io/gorm v1.25.12 xorm.io/builder v0.3.9 xorm.io/xorm v1.2.5 ) @@ -54,14 +57,12 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/eapache/go-resiliency v1.1.0 // indirect github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect github.com/eapache/queue v1.1.0 // indirect github.com/emirpasic/gods v1.12.0 // indirect - github.com/fatih/color v1.13.0 // indirect github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-kratos/aegis v0.2.0 // indirect @@ -79,6 +80,8 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/hetiansu5/accesslog v1.0.0 // indirect github.com/hetiansu5/cores v1.0.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -87,7 +90,6 @@ require ( github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect github.com/lestrrat-go/strftime v1.0.5 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-colorable v0.1.9 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -100,19 +102,16 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/qit-team/snow v1.2.4 // indirect github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect github.com/richardlehane/mscfb v1.0.4 // indirect github.com/richardlehane/msoleps v1.0.4 // indirect github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/tidwall/gjson v1.12.1 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/ugorji/go/codec v1.2.6 // indirect - github.com/urfave/cli/v2 v2.3.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect diff --git a/go.sum b/go.sum index 487cb9d..7ebd261 100644 --- a/go.sum +++ b/go.sum @@ -57,7 +57,6 @@ github.com/Shopify/sarama v1.19.0 h1:9oksLxC6uxVPHPVYUmq6xhr1BOF/hHobWH2UzO67z1s github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/SkyAPM/go2sky v0.6.0/go.mod h1:TANzYw5EvIlTidGWvQxtvO87rM6C746HkM0xkWqnPQw= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs= @@ -140,8 +139,6 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -174,8 +171,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/forgoer/openssl v1.6.0 h1:IueL+UfH0hKo99xFPojHLlO3QzRBQqFY+Cht0WwtOC0= github.com/forgoer/openssl v1.6.0/go.mod h1:9DZ4yOsQmveP0aXC/BpQ++Y5TKaz5yR9+emcxmIZNZs= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -241,11 +236,11 @@ github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPg github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-redis/redis/v8 v8.11.4 h1:kHoYkfZP6+pe04aFTnhDH6GDROa5yJdHJVNxV3F46Tg= github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w= -github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= +github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/goccy/go-json v0.7.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= @@ -436,6 +431,12 @@ github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0f github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -509,8 +510,6 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -595,10 +594,6 @@ github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= -github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= -github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= -github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= @@ -647,8 +642,6 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/qit-team/snow v1.2.4 h1:GFHcCJAgOnJ/rNp8Sde/TKcNSd34cf73g2t9oJbhzPs= -github.com/qit-team/snow v1.2.4/go.mod h1:4uqDUm4L9+qriJNXnaD1cA6/9aAQwHPX+Qwh4dp87yM= github.com/qit-team/snow-core v0.1.28 h1:RrX7i6GLbcMMSVzAT1lXgS/S3M2b1OrAnsoPaRGR4PI= github.com/qit-team/snow-core v0.1.28/go.mod h1:J9CNj6P2IRh72yVa7rut4T8ikq/4DjaisLqXZy40TNg= github.com/qit-team/work v0.3.11 h1:AAtLTCOJ01WMFcvviK9rDGhHzaHE3bvunMOnSZ/80k8= @@ -677,8 +670,6 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= @@ -735,7 +726,6 @@ github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuI github.com/swaggo/gin-swagger v1.3.3 h1:XHyYmeNVFG5PbyWHG4jXtxOm2P4kiZapDCWsyDDiQ/I= github.com/swaggo/gin-swagger v1.3.3/go.mod h1:ymsZuGpbbu+S7ZoQ49QPpZoDBj6uqhb8WizgQPVgWl0= github.com/swaggo/swag v1.7.4/go.mod h1:zD8h6h4SPv7t3l+4BKdRquqW1ASWjKZgT6Qv9z3kNqI= -github.com/swaggo/swag v1.7.6/go.mod h1:7vLqNYEtYoIsD14wXgy9oDS65MNiDANrPtbk9rnLuj0= github.com/swaggo/swag v1.7.9 h1:6vCG5mm43ebDzGlZPMGYrYI4zKFfOr5kicQX8qjeDwc= github.com/swaggo/swag v1.7.9/go.mod h1:gZ+TJ2w/Ve1RwQsA2IRoSOTidHz6DX+PIG8GWvbnoLU= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= @@ -759,9 +749,7 @@ github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLY github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= @@ -937,7 +925,6 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= @@ -1049,7 +1036,6 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20181010134911-4d1c5fb19474/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -1294,6 +1280,11 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= +gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= +gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= +gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8= +gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=