diff --git a/go.mod b/go.mod index ca499d8..9537c75 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,10 @@ module github.com/actiontech/sqle-oracle-plugin go 1.16 require ( - github.com/actiontech/sqle v1.2111.0 + github.com/actiontech/sqle v1.2112.0-pre3.0.20211221052644-26511be32375 github.com/denisenkom/go-mssqldb v0.11.0 // indirect github.com/fatih/color v1.13.0 // indirect + github.com/go-playground/validator v9.31.0+incompatible // indirect github.com/golang/glog v1.0.0 // indirect github.com/hashicorp/go-hclog v1.0.0 // indirect github.com/hashicorp/go-plugin v1.4.3 // indirect diff --git a/go.sum b/go.sum index 0143244..f9d958c 100644 --- a/go.sum +++ b/go.sum @@ -84,6 +84,8 @@ github.com/VividCortex/mysqlerr v0.0.0-20201215173831-4c396ae82aac/go.mod h1:f3H github.com/actiontech/mybatis-mapper-2-sql v0.0.0-20211116051932-8d94d78be18a/go.mod h1:C2CICYfJ/MRX9XpBqjp15MXN3X15mlhDJc35CTZTzWQ= github.com/actiontech/sqle v1.2111.0 h1:53DRn5caIoySjw6vPBuQNFKdop96jN1weGbJjIoBoiw= github.com/actiontech/sqle v1.2111.0/go.mod h1:PwRkjS6/TjbaJVE/ZuM1V9SiVq+nQKWUi7b8NERMUcQ= +github.com/actiontech/sqle v1.2112.0-pre3.0.20211221052644-26511be32375 h1:37Izj8acGLm8VZFm0FXyky6cC+IBTjqKG7xHRllE2JI= +github.com/actiontech/sqle v1.2112.0-pre3.0.20211221052644-26511be32375/go.mod h1:TrwWjSUN4L9/3o4fQfONXlHVvNJZKrSccoZQZwI1OuA= github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= @@ -296,10 +298,14 @@ github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfT github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/overalls v0.0.0-20180201144345-22ec1a223b7c/go.mod h1:UqxAgEOt89sCiXlrc/ycnx00LVvUO/eS8tMUkWX4R7w= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator v9.31.0+incompatible/go.mod h1:yrEkQXlcI+PugkyDjY2bRrL/UBU4f3rvrgkN3V8JEig= +github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-sql-driver/mysql v0.0.0-20170715192408-3955978caca4/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -563,6 +569,7 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.0.0/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= @@ -707,6 +714,7 @@ github.com/pingcap/tidb v0.0.0-20200312110807-8c4696b3f340/go.mod h1:xmqS96Ce1lU github.com/pingcap/tidb-tools v3.0.6-0.20191119150227-ff0a3c6e5763+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM= github.com/pingcap/tipb v0.0.0-20191120045257-1b9900292ab6/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI= github.com/pires/go-proxyproto v0.0.0-20191211124218-517ecdf5bb2b/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -758,6 +766,8 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= 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= @@ -1139,6 +1149,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 h1:kwrAHlwJ0DUBZwQ238v+Uod/3eZ8B2K5rYsUHBQvzmI= diff --git a/vendor/github.com/actiontech/sqle/sqle/driver/driver.go b/vendor/github.com/actiontech/sqle/sqle/driver/driver.go index 883db47..0484cfa 100644 --- a/vendor/github.com/actiontech/sqle/sqle/driver/driver.go +++ b/vendor/github.com/actiontech/sqle/sqle/driver/driver.go @@ -60,39 +60,134 @@ var ruleLevelMap = map[RuleLevel]int{ RuleLevelError: 3, } -type Rule struct { - Name string - Desc string +type RuleParamType string - // Category is the category of the rule. Such as "Naming Conventions"... - // Rules will be displayed on the SQLE rule list page by category. - Category string +const ( + RuleParamTypeString RuleParamType = "string" + RuleParamTypeInt RuleParamType = "int" + RuleParamTypeBool RuleParamType = "bool" +) - Level RuleLevel - Value string +type RuleParam struct { + Key string `json:"key"` + Value string `json:"value"` + Desc string `json:"desc"` + Type RuleParamType `json:"type"` } -func (r *Rule) GetValueInt(defaultRule *Rule) int64 { - value := r.GetValue() - i, err := strconv.ParseInt(value, 10, 64) - if err == nil { - return i +type RuleParams []*RuleParam + +func (r *RuleParams) SetParamValue(key, value string) error { + paramNotFoundErrMsg := "param %s not found" + if r == nil { + return fmt.Errorf(paramNotFoundErrMsg, key) } - i, err = strconv.ParseInt(defaultRule.GetValue(), 10, 64) - if err == nil { - return i + for _, p := range *r { + var err error + if p.Key == key { + switch p.Type { + case RuleParamTypeBool: + _, err = strconv.ParseBool(value) + case RuleParamTypeInt: + _, err = strconv.Atoi(value) + default: + } + if err != nil { + return fmt.Errorf("param %s value don't match \"%s\"", key, p.Type) + } + p.Value = value + return nil + } } - return 0 + return fmt.Errorf(paramNotFoundErrMsg, key) } -func (r *Rule) GetValue() string { +func (r *RuleParams) GetParam(key string) *RuleParam { + if r == nil { + return nil + } + for _, p := range *r { + if p.Key == key { + return p + } + } + return nil +} + +func (r *RuleParam) String() string { if r == nil { return "" } return r.Value } -// Config difine the configuration for driver. +func (r *RuleParam) Int() int { + if r == nil { + return 0 + } + i, err := strconv.Atoi(r.Value) + if err != nil { + return 0 + } + return i +} + +func (r *RuleParam) Bool() bool { + if r == nil { + return false + } + b, err := strconv.ParseBool(r.Value) + if err != nil { + return false + } + return b +} + +type Rule struct { + Name string + Desc string + + // Category is the category of the rule. Such as "Naming Conventions"... + // Rules will be displayed on the SQLE rule list page by category. + Category string + Level RuleLevel + Params RuleParams +} + +//func (r *Rule) GetValueInt(defaultRule *Rule) int64 { +// value := r.getValue(DefaultSingleParamKeyName, defaultRule) +// i, err := strconv.ParseInt(value, 10, 64) +// if err != nil { +// return 0 +// } +// return i +//} +// +//func (r *Rule) GetSingleValue() string { +// value, _ := r.Params.GetParamValue(DefaultSingleParamKeyName) +// return value +//} +// +//func (r *Rule) GetSingleValueInt() int { +// value := r.GetSingleValue() +// i, err := strconv.Atoi(value) +// if err != nil { +// return 0 +// } +// return i +//} + +//func (r *Rule) getValue(key string, defaultRule *Rule) string { +// var value string +// var exist bool +// value, exist = r.Params.GetParamValue(key) +// if !exist { +// value, _ = defaultRule.Params.GetParamValue(key) +// } +// return value +//} + +// Config define the configuration for driver. type Config struct { DSN *DSN Rules []*Rule @@ -101,7 +196,7 @@ type Config struct { // NewConfig return a config for driver. // // 1. dsn is nil, rules is not nil. Use drive to do Offline Audit. -// 2. dsn is not nil, rule is nil. Use drive to communicate with databse only. +// 2. dsn is not nil, rule is nil. Use drive to communicate with database only. // 3. dsn is not nil, rule is not nil. Most common usecase. func NewConfig(dsn *DSN, rules []*Rule) (*Config, error) { if dsn == nil && rules == nil { @@ -139,11 +234,11 @@ func Register(name string, h handler, rs []*Rule) { rulesMu.Unlock() } -type ErrDriverNotSupported struct { +type DriverNotSupportedError struct { DriverTyp string } -func (e *ErrDriverNotSupported) Error() string { +func (e *DriverNotSupportedError) Error() string { return fmt.Sprintf("driver type %v is not supported", e.DriverTyp) } @@ -184,7 +279,7 @@ var ErrNodesCountExceedOne = errors.New("after parse, nodes count exceed one") // It's implementation maybe on the same process or over gRPC(by go-plugin). // // Driver is responsible for two primary things: -// 1. privode handle to communicate with database +// 1. provides handle to communicate with database // 2. audit SQL with rules type Driver interface { Close(ctx context.Context) diff --git a/vendor/github.com/actiontech/sqle/sqle/driver/plugin.go b/vendor/github.com/actiontech/sqle/sqle/driver/plugin.go index 022e04f..9c7011a 100644 --- a/vendor/github.com/actiontech/sqle/sqle/driver/plugin.go +++ b/vendor/github.com/actiontech/sqle/sqle/driver/plugin.go @@ -17,6 +17,44 @@ import ( "google.golang.org/grpc" ) +func convertRuleFromProtoToDriver(rule *proto.Rule) *Rule { + var params = make(RuleParams, 0, len(rule.Params)) + for _, p := range rule.Params { + params = append(params, &RuleParam{ + Key: p.Key, + Value: p.Value, + Desc: p.Desc, + Type: RuleParamType(p.Type), + }) + } + return &Rule{ + Name: rule.Name, + Category: rule.Category, + Desc: rule.Desc, + Level: RuleLevel(rule.Level), + Params: params, + } +} + +func convertRuleFromDriverToProto(rule *Rule) *proto.Rule { + var params = make([]*proto.Param, 0, len(rule.Params)) + for _, p := range rule.Params { + params = append(params, &proto.Param{ + Key: p.Key, + Value: p.Value, + Desc: p.Desc, + Type: string(p.Type), + }) + } + return &proto.Rule{ + Name: rule.Name, + Desc: rule.Desc, + Level: string(rule.Level), + Category: rule.Category, + Params: params, + } +} + // InitPlugins init plugins at plugins directory. It should be called on host process. func InitPlugins(pluginDir string) error { if pluginDir == "" { @@ -33,10 +71,8 @@ func InitPlugins(pluginDir string) error { AllowedProtocols: []goPlugin.Protocol{goPlugin.ProtocolGRPC}, }) go func() { - select { - case <-closeCh: - client.Kill() - } + <-closeCh + client.Kill() }() gRPCClient, err := client.Client() @@ -47,12 +83,14 @@ func InitPlugins(pluginDir string) error { if err != nil { return nil, err } + // srv can only be proto.DriverClient + //nolint:forcetypeassert srv := rawI.(proto.DriverClient) return srv, nil } var plugins []os.FileInfo - filepath.Walk(pluginDir, func(path string, info os.FileInfo, err error) error { + if err := filepath.Walk(pluginDir, func(path string, info os.FileInfo, err error) error { if err != nil { return errors.Wrap(err, "init plugin") } @@ -62,7 +100,10 @@ func InitPlugins(pluginDir string) error { } plugins = append(plugins, info) return nil - }) + }); err != nil { + return err + } + for _, p := range plugins { binaryPath := filepath.Join(pluginDir, p.Name()) @@ -78,15 +119,9 @@ func InitPlugins(pluginDir string) error { close(closeCh) // driverRules get from plugin when plugin initialize. - var driverRules []*Rule + var driverRules = make([]*Rule, 0, len(pluginMeta.Rules)) for _, rule := range pluginMeta.Rules { - driverRules = append(driverRules, &Rule{ - Category: rule.Category, - Name: rule.Name, - Desc: rule.Desc, - Value: rule.Value, - Level: RuleLevel(rule.Level), - }) + driverRules = append(driverRules, convertRuleFromProtoToDriver(rule)) } handler := func(log *logrus.Entry, config *Config) (Driver, error) { @@ -99,13 +134,7 @@ func InitPlugins(pluginDir string) error { // protoRules send to plugin for Audit. var protoRules []*proto.Rule for _, rule := range config.Rules { - protoRules = append(protoRules, &proto.Rule{ - Name: rule.Name, - Desc: rule.Desc, - Value: rule.Value, - Level: string(rule.Level), - Category: rule.Category, - }) + protoRules = append(protoRules, convertRuleFromDriverToProto(rule)) } initRequest := &proto.InitRequest{ @@ -166,7 +195,7 @@ var handshakeConfig = goPlugin.HandshakeConfig{ type driverPluginClient struct { plugin proto.DriverClient - // driverQuitCh pruduce a singal for telling caller that it's time to Client.Kill() plugin process. + // driverQuitCh produce a singal for telling caller that it's time to Client.Kill() plugin process. driverQuitCh chan struct{} } @@ -220,14 +249,14 @@ func (s *driverPluginClient) Tx(ctx context.Context, queries ...string) ([]drive return nil, err } - var ret []driver.Result - for _, result := range resp.Resluts { - ret = append(ret, &dbDriverResult{ + ret := make([]driver.Result, len(resp.Results)) + for i, result := range resp.Results { + ret[i] = &dbDriverResult{ lastInsertId: result.LastInsertId, lastInsertIdErr: result.LastInsertIdError, rowsAffected: result.RowsAffected, rowsAffectedErr: result.RowsAffectedError, - }) + } } return ret, nil } @@ -246,13 +275,13 @@ func (s *driverPluginClient) Parse(ctx context.Context, sqlText string) ([]Node, return nil, err } - var nodes []Node - for _, node := range resp.Nodes { - nodes = append(nodes, Node{ + nodes := make([]Node, len(resp.Nodes)) + for i, node := range resp.Nodes { + nodes[i] = Node{ Type: node.Type, Text: node.Text, Fingerprint: node.Fingerprint, - }) + } } return nodes, nil } @@ -293,15 +322,9 @@ type driverGRPCServer struct { } func (d *driverGRPCServer) Init(ctx context.Context, req *proto.InitRequest) (*proto.Empty, error) { - var driverRules []*Rule + var driverRules = make([]*Rule, 0, len(req.GetRules())) for _, rule := range req.GetRules() { - driverRules = append(driverRules, &Rule{ - Name: rule.Name, - Category: rule.Category, - Desc: rule.Desc, - Value: rule.Value, - Level: RuleLevel(rule.Level), - }) + driverRules = append(driverRules, convertRuleFromProtoToDriver(rule)) } var dsn *DSN @@ -335,7 +358,7 @@ func (d *driverGRPCServer) Ping(ctx context.Context, req *proto.Empty) (*proto.E func (d *driverGRPCServer) Exec(ctx context.Context, req *proto.ExecRequest) (*proto.ExecResponse, error) { result, err := d.impl.Exec(ctx, req.GetQuery()) if err != nil { - return &proto.ExecResponse{}, nil + return &proto.ExecResponse{}, err } resp := &proto.ExecResponse{} @@ -353,13 +376,13 @@ func (d *driverGRPCServer) Exec(ctx context.Context, req *proto.ExecRequest) (*p } func (d *driverGRPCServer) Tx(ctx context.Context, req *proto.TxRequest) (*proto.TxResponse, error) { - resluts, err := d.impl.Tx(ctx, req.GetQueries()...) + results, err := d.impl.Tx(ctx, req.GetQueries()...) if err != nil { - return &proto.TxResponse{}, nil + return &proto.TxResponse{}, err } txResp := &proto.TxResponse{} - for _, result := range resluts { + for _, result := range results { resp := &proto.ExecResponse{} lastInsertId, lastInsertIdErr := result.LastInsertId() @@ -373,7 +396,7 @@ func (d *driverGRPCServer) Tx(ctx context.Context, req *proto.TxRequest) (*proto resp.RowsAffectedError = rowsAffectedErr.Error() } - txResp.Resluts = append(txResp.Resluts, resp) + txResp.Results = append(txResp.Results, resp) } return txResp, nil } @@ -401,13 +424,13 @@ func (d *driverGRPCServer) Parse(ctx context.Context, req *proto.ParseRequest) ( } func (d *driverGRPCServer) Audit(ctx context.Context, req *proto.AuditRequest) (*proto.AuditResponse, error) { - auditResluts, err := d.impl.Audit(ctx, req.GetSql()) + auditResults, err := d.impl.Audit(ctx, req.GetSql()) if err != nil { - return &proto.AuditResponse{}, nil + return &proto.AuditResponse{}, err } resp := &proto.AuditResponse{} - for _, result := range auditResluts.results { + for _, result := range auditResults.results { resp.Results = append(resp.Results, &proto.AuditResult{ Level: string(result.level), Message: result.message, @@ -425,16 +448,10 @@ func (d *driverGRPCServer) GenRollbackSQL(ctx context.Context, req *proto.GenRol } func (d *driverGRPCServer) Metas(ctx context.Context, req *proto.Empty) (*proto.MetasResponse, error) { - var protoRules []*proto.Rule - - for _, r := range d.r.Rules() { - protoRules = append(protoRules, &proto.Rule{ - Name: r.Name, - Desc: r.Desc, - Level: string(r.Level), - Value: r.Value, - Category: r.Category, - }) + protoRules := make([]*proto.Rule, len(d.r.Rules())) + + for i, r := range d.r.Rules() { + protoRules[i] = convertRuleFromDriverToProto(r) } return &proto.MetasResponse{ diff --git a/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.pb.go b/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.pb.go index aae929d..db17b5f 100644 --- a/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.pb.go +++ b/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.pb.go @@ -10,6 +10,7 @@ It is generated from these files: It has these top-level messages: DSN Rule + Param InitRequest Empty ExecRequest @@ -98,11 +99,12 @@ func (m *DSN) GetDatabase() string { } type Rule struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - Desc string `protobuf:"bytes,2,opt,name=desc" json:"desc,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` - Level string `protobuf:"bytes,4,opt,name=level" json:"level,omitempty"` - Category string `protobuf:"bytes,5,opt,name=category" json:"category,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Desc string `protobuf:"bytes,2,opt,name=desc" json:"desc,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"` + Level string `protobuf:"bytes,4,opt,name=level" json:"level,omitempty"` + Category string `protobuf:"bytes,5,opt,name=category" json:"category,omitempty"` + Params []*Param `protobuf:"bytes,6,rep,name=params" json:"params,omitempty"` } func (m *Rule) Reset() { *m = Rule{} } @@ -145,6 +147,53 @@ func (m *Rule) GetCategory() string { return "" } +func (m *Rule) GetParams() []*Param { + if m != nil { + return m.Params + } + return nil +} + +type Param struct { + Key string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Desc string `protobuf:"bytes,3,opt,name=desc" json:"desc,omitempty"` + Type string `protobuf:"bytes,4,opt,name=type" json:"type,omitempty"` +} + +func (m *Param) Reset() { *m = Param{} } +func (m *Param) String() string { return proto1.CompactTextString(m) } +func (*Param) ProtoMessage() {} +func (*Param) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *Param) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *Param) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *Param) GetDesc() string { + if m != nil { + return m.Desc + } + return "" +} + +func (m *Param) GetType() string { + if m != nil { + return m.Type + } + return "" +} + type InitRequest struct { Dsn *DSN `protobuf:"bytes,1,opt,name=dsn" json:"dsn,omitempty"` Rules []*Rule `protobuf:"bytes,3,rep,name=rules" json:"rules,omitempty"` @@ -153,7 +202,7 @@ type InitRequest struct { func (m *InitRequest) Reset() { *m = InitRequest{} } func (m *InitRequest) String() string { return proto1.CompactTextString(m) } func (*InitRequest) ProtoMessage() {} -func (*InitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (*InitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } func (m *InitRequest) GetDsn() *DSN { if m != nil { @@ -175,7 +224,7 @@ type Empty struct { func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto1.CompactTextString(m) } func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } type ExecRequest struct { Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` @@ -184,7 +233,7 @@ type ExecRequest struct { func (m *ExecRequest) Reset() { *m = ExecRequest{} } func (m *ExecRequest) String() string { return proto1.CompactTextString(m) } func (*ExecRequest) ProtoMessage() {} -func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (*ExecRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *ExecRequest) GetQuery() string { if m != nil { @@ -203,7 +252,7 @@ type ExecResponse struct { func (m *ExecResponse) Reset() { *m = ExecResponse{} } func (m *ExecResponse) String() string { return proto1.CompactTextString(m) } func (*ExecResponse) ProtoMessage() {} -func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (*ExecResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } func (m *ExecResponse) GetLastInsertId() int64 { if m != nil { @@ -240,7 +289,7 @@ type TxRequest struct { func (m *TxRequest) Reset() { *m = TxRequest{} } func (m *TxRequest) String() string { return proto1.CompactTextString(m) } func (*TxRequest) ProtoMessage() {} -func (*TxRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (*TxRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *TxRequest) GetQueries() []string { if m != nil { @@ -250,17 +299,17 @@ func (m *TxRequest) GetQueries() []string { } type TxResponse struct { - Resluts []*ExecResponse `protobuf:"bytes,1,rep,name=resluts" json:"resluts,omitempty"` + Results []*ExecResponse `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"` } func (m *TxResponse) Reset() { *m = TxResponse{} } func (m *TxResponse) String() string { return proto1.CompactTextString(m) } func (*TxResponse) ProtoMessage() {} -func (*TxResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (*TxResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } -func (m *TxResponse) GetResluts() []*ExecResponse { +func (m *TxResponse) GetResults() []*ExecResponse { if m != nil { - return m.Resluts + return m.Results } return nil } @@ -272,7 +321,7 @@ type DatabasesResponse struct { func (m *DatabasesResponse) Reset() { *m = DatabasesResponse{} } func (m *DatabasesResponse) String() string { return proto1.CompactTextString(m) } func (*DatabasesResponse) ProtoMessage() {} -func (*DatabasesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (*DatabasesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } func (m *DatabasesResponse) GetDatabases() []string { if m != nil { @@ -288,7 +337,7 @@ type ParseRequest struct { func (m *ParseRequest) Reset() { *m = ParseRequest{} } func (m *ParseRequest) String() string { return proto1.CompactTextString(m) } func (*ParseRequest) ProtoMessage() {} -func (*ParseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (*ParseRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *ParseRequest) GetSqlText() string { if m != nil { @@ -306,7 +355,7 @@ type Node struct { func (m *Node) Reset() { *m = Node{} } func (m *Node) String() string { return proto1.CompactTextString(m) } func (*Node) ProtoMessage() {} -func (*Node) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (*Node) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *Node) GetText() string { if m != nil { @@ -336,7 +385,7 @@ type ParseResponse struct { func (m *ParseResponse) Reset() { *m = ParseResponse{} } func (m *ParseResponse) String() string { return proto1.CompactTextString(m) } func (*ParseResponse) ProtoMessage() {} -func (*ParseResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (*ParseResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } func (m *ParseResponse) GetNodes() []*Node { if m != nil { @@ -352,7 +401,7 @@ type AuditRequest struct { func (m *AuditRequest) Reset() { *m = AuditRequest{} } func (m *AuditRequest) String() string { return proto1.CompactTextString(m) } func (*AuditRequest) ProtoMessage() {} -func (*AuditRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*AuditRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *AuditRequest) GetSql() string { if m != nil { @@ -369,7 +418,7 @@ type AuditResult struct { func (m *AuditResult) Reset() { *m = AuditResult{} } func (m *AuditResult) String() string { return proto1.CompactTextString(m) } func (*AuditResult) ProtoMessage() {} -func (*AuditResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*AuditResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *AuditResult) GetMessage() string { if m != nil { @@ -392,7 +441,7 @@ type AuditResponse struct { func (m *AuditResponse) Reset() { *m = AuditResponse{} } func (m *AuditResponse) String() string { return proto1.CompactTextString(m) } func (*AuditResponse) ProtoMessage() {} -func (*AuditResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (*AuditResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } func (m *AuditResponse) GetResults() []*AuditResult { if m != nil { @@ -408,7 +457,7 @@ type GenRollbackSQLRequest struct { func (m *GenRollbackSQLRequest) Reset() { *m = GenRollbackSQLRequest{} } func (m *GenRollbackSQLRequest) String() string { return proto1.CompactTextString(m) } func (*GenRollbackSQLRequest) ProtoMessage() {} -func (*GenRollbackSQLRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*GenRollbackSQLRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } func (m *GenRollbackSQLRequest) GetSql() string { if m != nil { @@ -425,7 +474,7 @@ type GenRollbackSQLResponse struct { func (m *GenRollbackSQLResponse) Reset() { *m = GenRollbackSQLResponse{} } func (m *GenRollbackSQLResponse) String() string { return proto1.CompactTextString(m) } func (*GenRollbackSQLResponse) ProtoMessage() {} -func (*GenRollbackSQLResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } +func (*GenRollbackSQLResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } func (m *GenRollbackSQLResponse) GetSql() string { if m != nil { @@ -449,7 +498,7 @@ type MetasResponse struct { func (m *MetasResponse) Reset() { *m = MetasResponse{} } func (m *MetasResponse) String() string { return proto1.CompactTextString(m) } func (*MetasResponse) ProtoMessage() {} -func (*MetasResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } +func (*MetasResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } func (m *MetasResponse) GetName() string { if m != nil { @@ -468,6 +517,7 @@ func (m *MetasResponse) GetRules() []*Rule { func init() { proto1.RegisterType((*DSN)(nil), "proto.DSN") proto1.RegisterType((*Rule)(nil), "proto.Rule") + proto1.RegisterType((*Param)(nil), "proto.Param") proto1.RegisterType((*InitRequest)(nil), "proto.InitRequest") proto1.RegisterType((*Empty)(nil), "proto.Empty") proto1.RegisterType((*ExecRequest)(nil), "proto.ExecRequest") @@ -500,7 +550,7 @@ type DriverClient interface { // Metas returns some base info from plugin server. Metas(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*MetasResponse, error) // Init will should be called at first before calling following methods. - // It will pass some necessary info to plugin server. In the begginning, + // It will pass some necessary info to plugin server. In the beginning, // we consider that put this info to the executable binary environment. // We put all communication on gRPC for unification in the end. Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*Empty, error) @@ -618,7 +668,7 @@ type DriverServer interface { // Metas returns some base info from plugin server. Metas(context.Context, *Empty) (*MetasResponse, error) // Init will should be called at first before calling following methods. - // It will pass some necessary info to plugin server. In the begginning, + // It will pass some necessary info to plugin server. In the beginning, // we consider that put this info to the executable binary environment. // We put all communication on gRPC for unification in the end. Init(context.Context, *InitRequest) (*Empty, error) @@ -868,51 +918,55 @@ var _Driver_serviceDesc = grpc.ServiceDesc{ func init() { proto1.RegisterFile("driver.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 735 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x4e, 0xdb, 0x4a, - 0x10, 0x56, 0xe2, 0x18, 0xc8, 0x38, 0x1c, 0xc1, 0x1e, 0x0e, 0xb2, 0x22, 0x8e, 0x14, 0x16, 0x55, - 0x0a, 0x2a, 0x05, 0x35, 0x5c, 0x22, 0x2e, 0xa0, 0xa1, 0x15, 0x52, 0x89, 0xa8, 0xe1, 0xaa, 0x77, - 0x26, 0x1e, 0xd2, 0xa8, 0xc6, 0x9b, 0xec, 0xae, 0x43, 0xf2, 0x5a, 0x7d, 0xb2, 0x3e, 0x42, 0xb5, - 0x7f, 0x8e, 0x4d, 0xa0, 0x57, 0x9e, 0x9f, 0x6f, 0xe7, 0x9b, 0x1d, 0x7f, 0xb3, 0xd0, 0x4a, 0xf8, - 0x78, 0x86, 0xfc, 0x78, 0xc2, 0x99, 0x64, 0xc4, 0xd7, 0x1f, 0xba, 0x00, 0xaf, 0x7f, 0x37, 0x20, - 0x04, 0x1a, 0x3f, 0x98, 0x90, 0x61, 0xad, 0x53, 0xeb, 0x36, 0x23, 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, 0xe8, 0x29, 0x34, - 0x8b, 0x05, 0x7a, 0xd1, 0x44, 0xe8, 0x9e, 0xb5, 0x95, 0x05, 0xeb, 0x81, 0xaf, 0x65, 0x4c, 0x1c, - 0x7b, 0x79, 0xa1, 0x8a, 0xb9, 0x55, 0x95, 0xde, 0x03, 0x5f, 0xcb, 0xa7, 0x38, 0x53, 0x16, 0x75, - 0x71, 0xa6, 0x2a, 0xc4, 0x1b, 0xf8, 0xa7, 0xaa, 0x17, 0xb2, 0x67, 0x71, 0xaf, 0x2a, 0xae, 0xfd, - 0xff, 0x1b, 0x59, 0x53, 0xee, 0x12, 0xbe, 0x6f, 0x1c, 0x9f, 0x9c, 0x69, 0xc8, 0xc3, 0x9a, 0xfe, - 0x9c, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x87, 0xce, 0xf0, 0xb0, 0xe0, 0x06, 0x00, 0x00, + // 797 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xdd, 0x4e, 0xf3, 0x46, + 0x10, 0x55, 0x62, 0x3b, 0x7c, 0x19, 0x87, 0x0a, 0x16, 0x8a, 0xac, 0x88, 0x4a, 0x61, 0x69, 0xa5, + 0xa0, 0x52, 0x50, 0xc3, 0x25, 0xe2, 0x02, 0x1a, 0x5a, 0x21, 0x95, 0x28, 0x35, 0x48, 0x95, 0x7a, + 0x67, 0xe2, 0x21, 0x8d, 0x70, 0x6c, 0x67, 0x77, 0x0d, 0xc9, 0xdb, 0xf4, 0x19, 0xfa, 0x64, 0x7d, + 0x84, 0x6a, 0xff, 0x1c, 0x9b, 0xc0, 0x77, 0xe5, 0x99, 0x33, 0xb3, 0x33, 0x67, 0xd7, 0x67, 0x06, + 0x3a, 0x31, 0x9b, 0xbd, 0x22, 0x3b, 0xcb, 0x59, 0x26, 0x32, 0xe2, 0xa9, 0x0f, 0x5d, 0x81, 0x33, + 0x7c, 0x18,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d, 0x29, 0x6a, 0x32, 0xbb, 0xfb, 0xc6, 0xab, 0xb7, 0xeb, 0x83, + 0x2b, 0x17, 0x01, 0xb1, 0x6f, 0x52, 0xd9, 0x0a, 0xdd, 0xda, 0x79, 0x72, 0x0c, 0xde, 0x2f, 0x49, + 0xc6, 0xf1, 0x5d, 0xd9, 0x7a, 0x12, 0x05, 0x77, 0x3c, 0x4b, 0xa7, 0x5f, 0xcd, 0x39, 0x07, 0x57, + 0xaa, 0xbf, 0x6c, 0x59, 0xd9, 0x17, 0xdd, 0x8f, 0xc6, 0x83, 0x9c, 0x40, 0xf3, 0x71, 0x49, 0x76, + 0x4c, 0xa8, 0x1c, 0xc2, 0xee, 0x6e, 0x05, 0x31, 0xa9, 0x17, 0xd0, 0x2e, 0x07, 0xe8, 0x1d, 0x89, + 0xc0, 0xae, 0xb5, 0x8d, 0x01, 0x1b, 0xa8, 0x2d, 0xcb, 0x91, 0xec, 0xad, 0x97, 0x70, 0x39, 0x50, + 0xe5, 0xbb, 0xd5, 0x95, 0x3e, 0x00, 0x4f, 0xc9, 0xa7, 0x3c, 0x53, 0x15, 0x75, 0x79, 0xa6, 0x2e, + 0xc4, 0x7b, 0xf8, 0xa6, 0xae, 0x17, 0x72, 0x68, 0xf2, 0x3e, 0x54, 0x5c, 0xf7, 0xbb, 0x4f, 0xa2, + 0xba, 0xdc, 0x0d, 0xfc, 0xf5, 0xe5, 0xec, 0xfc, 0x52, 0xa5, 0x3c, 0xb5, 0xd4, 0xe7, 0xe2, 0xff, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x6b, 0xde, 0xcc, 0x64, 0x07, 0x00, 0x00, } diff --git a/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.proto b/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.proto index f338eb3..a764f72 100644 --- a/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.proto +++ b/vendor/github.com/actiontech/sqle/sqle/driver/proto/driver.proto @@ -7,7 +7,7 @@ service Driver { rpc Metas(Empty) returns (MetasResponse); // Init will should be called at first before calling following methods. - // It will pass some necessary info to plugin server. In the begginning, + // It will pass some necessary info to plugin server. In the beginning, // we consider that put this info to the executable binary environment. // We put all communication on gRPC for unification in the end. rpc Init(InitRequest) returns (Empty); @@ -32,9 +32,17 @@ message DSN { message Rule { string name = 1; string desc = 2; - string value = 3; + string value = 3 [deprecated=true]; string level = 4; string category = 5; + repeated Param params = 6; +} + +message Param { + string key = 1; + string value = 2; + string desc = 3; + string type = 4; } message InitRequest { @@ -60,7 +68,7 @@ message TxRequest { } message TxResponse { - repeated ExecResponse resluts = 1; + repeated ExecResponse results = 1; } message DatabasesResponse { diff --git a/vendor/github.com/actiontech/sqle/sqle/pkg/driver/adaptor.go b/vendor/github.com/actiontech/sqle/sqle/pkg/driver/adaptor.go index 994a3ea..0f881b6 100644 --- a/vendor/github.com/actiontech/sqle/sqle/pkg/driver/adaptor.go +++ b/vendor/github.com/actiontech/sqle/sqle/pkg/driver/adaptor.go @@ -15,7 +15,7 @@ import ( ) // Adaptor is a wrapper for the sqle driver layer. It -// privides a more simpler interface for the database plugin. +// provides a more simpler interface for the database plugin. type Adaptor struct { l hclog.Logger diff --git a/vendor/github.com/actiontech/sqle/sqle/utils/aes.go b/vendor/github.com/actiontech/sqle/sqle/utils/aes.go index a3c7122..87f9565 100644 --- a/vendor/github.com/actiontech/sqle/sqle/utils/aes.go +++ b/vendor/github.com/actiontech/sqle/sqle/utils/aes.go @@ -61,12 +61,12 @@ func AesEncrypt(origData string) (string, error) { return base64.StdEncoding.EncodeToString(crypted), nil } -func AesDecrypt(crypted string) (string, error) { - crytedByte, err := base64.StdEncoding.DecodeString(crypted) +func AesDecrypt(encrypted string) (string, error) { + encryptedByte, err := base64.StdEncoding.DecodeString(encrypted) if err != nil { return "", err } - origByte, err := aesDecrypt(crytedByte, AES_KEY) + origByte, err := aesDecrypt(encryptedByte, AES_KEY) return string(origByte), err } diff --git a/vendor/github.com/actiontech/sqle/sqle/utils/jwt.go b/vendor/github.com/actiontech/sqle/sqle/utils/jwt.go index 3e0b8e4..6675ccc 100644 --- a/vendor/github.com/actiontech/sqle/sqle/utils/jwt.go +++ b/vendor/github.com/actiontech/sqle/sqle/utils/jwt.go @@ -19,6 +19,8 @@ func NewJWT(signingKey []byte) *JWT { func (j *JWT) CreateToken(userName string, expireUnix int64, customClaims ...CustomClaimOption) (string, error) { token := jwt.New(jwt.SigningMethodHS256) + // claims can only be jwt.MapClaims + //nolint:forcetypeassert claims := token.Claims.(jwt.MapClaims) claims["name"] = userName claims["exp"] = expireUnix @@ -27,7 +29,7 @@ func (j *JWT) CreateToken(userName string, expireUnix int64, customClaims ...Cus cc.apply(claims) } - t, err := token.SignedString([]byte(j.key)) + t, err := token.SignedString(j.key) if err != nil { return "", err } @@ -65,7 +67,8 @@ func ParseAuditPlanName(tokenString string) (string, error) { if err != nil { return "", err } - + // claims can only be jwt.MapClaims + //nolint:forcetypeassert claims := token.Claims.(jwt.MapClaims) apn, ok := claims["apn"] if !ok { diff --git a/vendor/modules.txt b/vendor/modules.txt index 2d86d55..7278a02 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/actiontech/sqle v1.2111.0 +# github.com/actiontech/sqle v1.2112.0-pre3.0.20211221052644-26511be32375 ## explicit github.com/actiontech/sqle/sqle/driver github.com/actiontech/sqle/sqle/driver/proto @@ -17,6 +17,8 @@ github.com/dgrijalva/jwt-go # github.com/fatih/color v1.13.0 ## explicit github.com/fatih/color +# github.com/go-playground/validator v9.31.0+incompatible +## explicit # github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe github.com/golang-sql/civil # github.com/golang/glog v1.0.0