diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index de5bfb76cd..86526d8540 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -7,6 +7,7 @@ import ( "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/config/convert" "github.com/kyleconroy/sqlc/internal/info" + "github.com/kyleconroy/sqlc/internal/metadata" "github.com/kyleconroy/sqlc/internal/plugin" "github.com/kyleconroy/sqlc/internal/sql/catalog" ) @@ -226,9 +227,18 @@ func pluginQueries(r *compiler.Result) []*plugin.Query { Name: q.InsertIntoTable.Name, } } + var cmdParams *plugin.CmdParams + if q.CmdParams != (metadata.CmdParams{}) { + cmdParams = &plugin.CmdParams{ + ManyKey: q.CmdParams.ManyKey, + InsertMultiple: q.CmdParams.InsertMultiple, + NoInference: q.CmdParams.NoInference, + } + } out = append(out, &plugin.Query{ Name: q.Name, Cmd: q.Cmd, + CmdParams: cmdParams, Text: q.SQL, Comments: q.Comments, Columns: columns, diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 9ac5cc855a..03871ccaf7 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -70,7 +70,7 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, if err := validate.In(c.catalog, raw); err != nil { return nil, err } - name, cmd, err := metadata.Parse(strings.TrimSpace(rawSQL), c.parser.CommentSyntax()) + name, cmd, cmdParams, err := metadata.Parse(strings.TrimSpace(rawSQL), c.parser.CommentSyntax()) if err != nil { return nil, err } @@ -133,6 +133,7 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, Columns: cols, SQL: trimmed, InsertIntoTable: table, + CmdParams: cmdParams, }, nil } diff --git a/internal/compiler/query.go b/internal/compiler/query.go index c3e754cc04..349d402c1e 100644 --- a/internal/compiler/query.go +++ b/internal/compiler/query.go @@ -1,6 +1,7 @@ package compiler import ( + "github.com/kyleconroy/sqlc/internal/metadata" "github.com/kyleconroy/sqlc/internal/sql/ast" ) @@ -39,12 +40,13 @@ type Column struct { } type Query struct { - SQL string - Name string - Cmd string // TODO: Pick a better name. One of: one, many, exec, execrows, copyFrom - Columns []*Column - Params []Parameter - Comments []string + SQL string + Name string + Cmd string // TODO: Pick a better name. One of: one, many, exec, execrows, copyFrom + CmdParams metadata.CmdParams + Columns []*Column + Params []Parameter + Comments []string // XXX: Hack Filename string diff --git a/internal/endtoend/testdata/codegen_json/gen/codegen.json b/internal/endtoend/testdata/codegen_json/gen/codegen.json index 0afd9fa665..94fa873312 100644 --- a/internal/endtoend/testdata/codegen_json/gen/codegen.json +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -62583,6 +62583,7 @@ "text": "SELECT id, name, bio FROM authors\nWHERE id = $1 LIMIT 1", "name": "GetAuthor", "cmd": ":one", + "cmd_params": null, "columns": [ { "name": "id", @@ -62698,6 +62699,7 @@ "text": "SELECT id, name, bio FROM authors\nORDER BY name", "name": "ListAuthors", "cmd": ":many", + "cmd_params": null, "columns": [ { "name": "id", @@ -62784,6 +62786,7 @@ "text": "INSERT INTO authors (\n name, bio\n) VALUES (\n $1, $2\n)\nRETURNING id, name, bio", "name": "CreateAuthor", "cmd": ":one", + "cmd_params": null, "columns": [ { "name": "id", @@ -62931,6 +62934,7 @@ "text": "DELETE FROM authors\nWHERE id = $1", "name": "DeleteAuthor", "cmd": ":exec", + "cmd_params": null, "columns": [], "params": [ { diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt index cbe1df4446..f865fa9851 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v4/stderr.txt @@ -1,6 +1,6 @@ # package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many +query.sql:4:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos +query.sql:7:1: invalid query command parameter ":many" query.sql:10:1: invalid query type: :two query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt index cbe1df4446..f865fa9851 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/pgx/v5/stderr.txt @@ -1,6 +1,6 @@ # package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many +query.sql:4:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos +query.sql:7:1: invalid query command parameter ":many" query.sql:10:1: invalid query type: :two query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt index cbe1df4446..f865fa9851 100644 --- a/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt +++ b/internal/endtoend/testdata/invalid_queries_foo/stdlib/stderr.txt @@ -1,6 +1,6 @@ # package querytest -query.sql:4:1: invalid query comment: -- name: ListFoos -query.sql:7:1: invalid query comment: -- name: ListFoos :one :many +query.sql:4:1: missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: -- name: ListFoos +query.sql:7:1: invalid query command parameter ":many" query.sql:10:1: invalid query type: :two query.sql:13:1: query "DeleteFoo" specifies parameter ":one" without containing a RETURNING clause query.sql:16:1: query "UpdateFoo" specifies parameter ":one" without containing a RETURNING clause diff --git a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json index 8aa57cc330..0e4a6bb928 100644 --- a/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_disabled/gen/codegen.json @@ -62583,6 +62583,7 @@ "text": "SELECT id, name, bio FROM authors\nWHERE id = $1 LIMIT 1", "name": "GetAuthor", "cmd": ":one", + "cmd_params": null, "columns": [ { "name": "id", @@ -62698,6 +62699,7 @@ "text": "SELECT id, name, bio FROM authors\nORDER BY name", "name": "ListAuthors", "cmd": ":many", + "cmd_params": null, "columns": [ { "name": "id", @@ -62784,6 +62786,7 @@ "text": "INSERT INTO authors (\n name, bio\n) VALUES (\n $1, $2\n)\nRETURNING id, name, bio", "name": "CreateAuthor", "cmd": ":one", + "cmd_params": null, "columns": [ { "name": "id", @@ -62931,6 +62934,7 @@ "text": "DELETE FROM authors\nWHERE id = $1", "name": "DeleteAuthor", "cmd": ":exec", + "cmd_params": null, "columns": [], "params": [ { diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json index 8aa57cc330..0e4a6bb928 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json @@ -62583,6 +62583,7 @@ "text": "SELECT id, name, bio FROM authors\nWHERE id = $1 LIMIT 1", "name": "GetAuthor", "cmd": ":one", + "cmd_params": null, "columns": [ { "name": "id", @@ -62698,6 +62699,7 @@ "text": "SELECT id, name, bio FROM authors\nORDER BY name", "name": "ListAuthors", "cmd": ":many", + "cmd_params": null, "columns": [ { "name": "id", @@ -62784,6 +62786,7 @@ "text": "INSERT INTO authors (\n name, bio\n) VALUES (\n $1, $2\n)\nRETURNING id, name, bio", "name": "CreateAuthor", "cmd": ":one", + "cmd_params": null, "columns": [ { "name": "id", @@ -62931,6 +62934,7 @@ "text": "DELETE FROM authors\nWHERE id = $1", "name": "DeleteAuthor", "cmd": ":exec", + "cmd_params": null, "columns": [], "params": [ { diff --git a/internal/metadata/meta.go b/internal/metadata/meta.go index 59a1add763..8658c0ba79 100644 --- a/internal/metadata/meta.go +++ b/internal/metadata/meta.go @@ -25,6 +25,12 @@ const ( CmdBatchOne = ":batchone" ) +type CmdParams struct { + ManyKey string + InsertMultiple bool + NoInference bool +} + // A query name must be a valid Go identifier // // https://golang.org/ref/spec#Identifiers @@ -44,7 +50,7 @@ func validateQueryName(name string) error { return nil } -func Parse(t string, commentStyle CommentSyntax) (string, string, error) { +func Parse(t string, commentStyle CommentSyntax) (string, string, CmdParams, error) { for _, line := range strings.Split(t, "\n") { var prefix string if strings.HasPrefix(line, "--") { @@ -76,30 +82,56 @@ func Parse(t string, commentStyle CommentSyntax) (string, string, error) { continue } if !strings.HasPrefix(rest, " name: ") { - return "", "", fmt.Errorf("invalid metadata: %s", line) + return "", "", CmdParams{}, fmt.Errorf("invalid metadata: %s", line) } part := strings.Split(strings.TrimSpace(line), " ") if prefix == "/*" { part = part[:len(part)-1] // removes the trailing "*/" element } - if len(part) == 2 { - return "", "", fmt.Errorf("missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: %s", line) - } - if len(part) != 4 { - return "", "", fmt.Errorf("invalid query comment: %s", line) + if len(part) < 4 { + return "", "", CmdParams{}, fmt.Errorf("missing query type [':one', ':many', ':exec', ':execrows', ':execlastid', ':execresult', ':copyfrom', 'batchexec', 'batchmany', 'batchone']: %s", line) } queryName := part[2] queryType := strings.TrimSpace(part[3]) switch queryType { case CmdOne, CmdMany, CmdExec, CmdExecResult, CmdExecRows, CmdExecLastId, CmdCopyFrom, CmdBatchExec, CmdBatchMany, CmdBatchOne: default: - return "", "", fmt.Errorf("invalid query type: %s", queryType) + return "", "", CmdParams{}, fmt.Errorf("invalid query type: %s", queryType) } if err := validateQueryName(queryName); err != nil { - return "", "", err + return "", "", CmdParams{}, err + } + cmdParams, err := parseCmdParams(part[4:], queryType) + if err != nil { + return "", "", CmdParams{}, err + } + return queryName, queryType, cmdParams, nil + } + return "", "", CmdParams{}, nil +} + +func parseCmdParams(part []string, queryType string) (CmdParams, error) { + var ret CmdParams + for _, p := range part { + if p == "multiple" { + if queryType != CmdExec && queryType != CmdExecResult && queryType != CmdExecRows && queryType != CmdExecLastId { + return ret, fmt.Errorf("query command parameter multiple is invalid for query type %s", queryType) + } + ret.InsertMultiple = true + } else if p == "no-inference" { + if queryType != CmdExec && queryType != CmdExecResult && queryType != CmdExecRows && queryType != CmdExecLastId { + return ret, fmt.Errorf("query command parameter no-inference is invalid for query type %s", queryType) + } + ret.NoInference = true + } else if strings.HasPrefix(p, "key=") { + if queryType != CmdMany { + return ret, fmt.Errorf("query command parameter %s is invalid for query type %s", p, queryType) + } + ret.ManyKey = strings.TrimPrefix(p, "key=") + } else { + return ret, fmt.Errorf("invalid query command parameter %q", p) } - return queryName, queryType, nil } - return "", "", nil + return ret, nil } diff --git a/internal/metadata/meta_test.go b/internal/metadata/meta_test.go index e2f7905cba..91abdfe7aa 100644 --- a/internal/metadata/meta_test.go +++ b/internal/metadata/meta_test.go @@ -2,7 +2,7 @@ package metadata import "testing" -func TestParseMetadata(t *testing.T) { +func TestNonMetadata(t *testing.T) { for _, query := range []string{ `-- name: CreateFoo, :one`, @@ -17,7 +17,7 @@ func TestParseMetadata(t *testing.T) { "-- name:CreateFoo", `--name:CreateFoo :two`, } { - if _, _, err := Parse(query, CommentSyntax{Dash: true}); err == nil { + if _, _, _, err := Parse(query, CommentSyntax{Dash: true}); err == nil { t.Errorf("expected invalid metadata: %q", query) } } @@ -27,21 +27,52 @@ func TestParseMetadata(t *testing.T) { `-- name comment`, `--name comment`, } { - if _, _, err := Parse(query, CommentSyntax{Dash: true}); err != nil { + if _, _, _, err := Parse(query, CommentSyntax{Dash: true}); err != nil { t.Errorf("expected valid comment: %q", query) } } +} - query := `-- name: CreateFoo :one` - queryName, queryType, err := Parse(query, CommentSyntax{Dash: true}) - if err != nil { - t.Errorf("expected valid metadata: %q", query) - } - if queryName != "CreateFoo" { - t.Errorf("incorrect queryName parsed: %q", query) +func TestParse(t *testing.T) { + tests := []struct { + query string + wantName string + wantType string + wantCmdParams CmdParams + }{ + { + query: "-- name: CreateFoo :one", + wantName: "CreateFoo", + wantType: CmdOne, + }, + { + query: "-- name: InsertMulti :exec multiple", + wantName: "InsertMulti", + wantType: CmdExec, + wantCmdParams: CmdParams{InsertMultiple: true}, + }, + { + query: "-- name: SelectKey :many key=group_id", + wantName: "SelectKey", + wantType: CmdMany, + wantCmdParams: CmdParams{ManyKey: "group_id"}, + }, } - if queryType != CmdOne { - t.Errorf("incorrect queryType parsed: %q", query) + for _, tc := range tests { + t.Run(tc.query, func(t *testing.T) { + name, queryType, cmdParams, err := Parse(tc.query, CommentSyntax{Dash: true}) + if err != nil { + t.Fatalf("Parse failed: %v", err) + } + if name != tc.wantName { + t.Errorf("unexpected name: got %q; want %q", name, tc.wantName) + } + if queryType != tc.wantType { + t.Errorf("unexpected queryType: got %q; want %q", queryType, tc.wantType) + } + if cmdParams != tc.wantCmdParams { + t.Errorf("unexpected cmdParams: got %#v; want %#v", cmdParams, tc.wantCmdParams) + } + }) } - } diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 12003c9ba8..5d69b58133 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -1317,6 +1317,7 @@ type Query struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Cmd string `protobuf:"bytes,3,opt,name=cmd,proto3" json:"cmd,omitempty"` + CmdParams *CmdParams `protobuf:"bytes,9,opt,name=cmd_params,proto3" json:"cmd_params,omitempty"` Columns []*Column `protobuf:"bytes,4,rep,name=columns,proto3" json:"columns,omitempty"` Params []*Parameter `protobuf:"bytes,5,rep,name=params,json=parameters,proto3" json:"params,omitempty"` Comments []string `protobuf:"bytes,6,rep,name=comments,proto3" json:"comments,omitempty"` @@ -1377,6 +1378,13 @@ func (x *Query) GetCmd() string { return "" } +func (x *Query) GetCmdParams() *CmdParams { + if x != nil { + return x.CmdParams + } + return nil +} + func (x *Query) GetColumns() []*Column { if x != nil { return x.Columns @@ -1412,6 +1420,69 @@ func (x *Query) GetInsertIntoTable() *Identifier { return nil } +type CmdParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ManyKey string `protobuf:"bytes,1,opt,name=many_key,proto3" json:"many_key,omitempty"` + InsertMultiple bool `protobuf:"varint,2,opt,name=insert_multiple,proto3" json:"insert_multiple,omitempty"` + NoInference bool `protobuf:"varint,3,opt,name=no_inference,proto3" json:"no_inference,omitempty"` +} + +func (x *CmdParams) Reset() { + *x = CmdParams{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CmdParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmdParams) ProtoMessage() {} + +func (x *CmdParams) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmdParams.ProtoReflect.Descriptor instead. +func (*CmdParams) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{15} +} + +func (x *CmdParams) GetManyKey() string { + if x != nil { + return x.ManyKey + } + return "" +} + +func (x *CmdParams) GetInsertMultiple() bool { + if x != nil { + return x.InsertMultiple + } + return false +} + +func (x *CmdParams) GetNoInference() bool { + if x != nil { + return x.NoInference + } + return false +} + type Parameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1424,7 +1495,7 @@ type Parameter struct { func (x *Parameter) Reset() { *x = Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[15] + mi := &file_plugin_codegen_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1437,7 +1508,7 @@ func (x *Parameter) String() string { func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[15] + mi := &file_plugin_codegen_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1450,7 +1521,7 @@ func (x *Parameter) ProtoReflect() protoreflect.Message { // Deprecated: Use Parameter.ProtoReflect.Descriptor instead. func (*Parameter) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{15} + return file_plugin_codegen_proto_rawDescGZIP(), []int{16} } func (x *Parameter) GetNumber() int32 { @@ -1482,7 +1553,7 @@ type CodeGenRequest struct { func (x *CodeGenRequest) Reset() { *x = CodeGenRequest{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[16] + mi := &file_plugin_codegen_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1495,7 +1566,7 @@ func (x *CodeGenRequest) String() string { func (*CodeGenRequest) ProtoMessage() {} func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[16] + mi := &file_plugin_codegen_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1508,7 +1579,7 @@ func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CodeGenRequest.ProtoReflect.Descriptor instead. func (*CodeGenRequest) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{16} + return file_plugin_codegen_proto_rawDescGZIP(), []int{17} } func (x *CodeGenRequest) GetSettings() *Settings { @@ -1557,7 +1628,7 @@ type CodeGenResponse struct { func (x *CodeGenResponse) Reset() { *x = CodeGenResponse{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[17] + mi := &file_plugin_codegen_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1570,7 +1641,7 @@ func (x *CodeGenResponse) String() string { func (*CodeGenResponse) ProtoMessage() {} func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[17] + mi := &file_plugin_codegen_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1583,7 +1654,7 @@ func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CodeGenResponse.ProtoReflect.Descriptor instead. func (*CodeGenResponse) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{17} + return file_plugin_codegen_proto_rawDescGZIP(), []int{18} } func (x *CodeGenResponse) GetFiles() []*File { @@ -1604,7 +1675,7 @@ type VetParameter struct { func (x *VetParameter) Reset() { *x = VetParameter{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[18] + mi := &file_plugin_codegen_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1617,7 +1688,7 @@ func (x *VetParameter) String() string { func (*VetParameter) ProtoMessage() {} func (x *VetParameter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[18] + mi := &file_plugin_codegen_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1630,7 +1701,7 @@ func (x *VetParameter) ProtoReflect() protoreflect.Message { // Deprecated: Use VetParameter.ProtoReflect.Descriptor instead. func (*VetParameter) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{18} + return file_plugin_codegen_proto_rawDescGZIP(), []int{19} } func (x *VetParameter) GetNumber() int32 { @@ -1654,7 +1725,7 @@ type VetConfig struct { func (x *VetConfig) Reset() { *x = VetConfig{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[19] + mi := &file_plugin_codegen_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1667,7 +1738,7 @@ func (x *VetConfig) String() string { func (*VetConfig) ProtoMessage() {} func (x *VetConfig) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[19] + mi := &file_plugin_codegen_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1680,7 +1751,7 @@ func (x *VetConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use VetConfig.ProtoReflect.Descriptor instead. func (*VetConfig) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{19} + return file_plugin_codegen_proto_rawDescGZIP(), []int{20} } func (x *VetConfig) GetVersion() string { @@ -1725,7 +1796,7 @@ type VetQuery struct { func (x *VetQuery) Reset() { *x = VetQuery{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[20] + mi := &file_plugin_codegen_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1738,7 +1809,7 @@ func (x *VetQuery) String() string { func (*VetQuery) ProtoMessage() {} func (x *VetQuery) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[20] + mi := &file_plugin_codegen_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1751,7 +1822,7 @@ func (x *VetQuery) ProtoReflect() protoreflect.Message { // Deprecated: Use VetQuery.ProtoReflect.Descriptor instead. func (*VetQuery) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{20} + return file_plugin_codegen_proto_rawDescGZIP(), []int{21} } func (x *VetQuery) GetSql() string { @@ -2017,72 +2088,82 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, - 0x65, 0x64, 0x22, 0x94, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, + 0x65, 0x64, 0x22, 0xc7, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, - 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, - 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, - 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, - 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 0xde, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x47, - 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x12, 0x27, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, - 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x26, 0x0a, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x35, 0x0a, 0x0f, 0x43, 0x6f, 0x64, 0x65, 0x47, - 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, - 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x26, - 0x0a, 0x0c, 0x56, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, - 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x56, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, - 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, - 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x22, 0x74, 0x0a, 0x08, 0x56, 0x65, 0x74, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x71, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x56, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x7e, 0x0a, - 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, - 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6b, 0x79, 0x6c, 0x65, 0x63, 0x6f, 0x6e, 0x72, - 0x6f, 0x79, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, - 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, - 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x31, 0x0a, 0x0a, 0x63, 0x6d, 0x64, 0x5f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6d, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x63, + 0x6d, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, + 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1a, + 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x11, 0x69, 0x6e, + 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, + 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x75, 0x0a, 0x09, + 0x43, 0x6d, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, + 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, + 0x79, 0x5f, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, + 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, + 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x12, + 0x22, 0x0a, 0x0c, 0x6e, 0x6f, 0x5f, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6e, 0x6f, 0x5f, 0x69, 0x6e, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x22, 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, + 0x6d, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x22, 0xde, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, 0x61, + 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, 0x07, + 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, + 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, 0x6c, + 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, 0x75, + 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x22, 0x35, 0x0a, 0x0f, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, + 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0c, 0x56, 0x65, 0x74, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0x6f, 0x0a, 0x09, 0x56, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x67, 0x69, 0x6e, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, + 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, + 0x73, 0x22, 0x74, 0x0a, 0x08, 0x56, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x73, 0x71, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x56, + 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x7e, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6b, 0x79, 0x6c, 0x65, 0x63, 0x6f, 0x6e, 0x72, 0x6f, 0x79, 0x2f, 0x73, 0x71, 0x6c, + 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0xca, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2097,7 +2178,7 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 23) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 24) var file_plugin_codegen_proto_goTypes = []interface{}{ (*File)(nil), // 0: plugin.File (*Override)(nil), // 1: plugin.Override @@ -2114,20 +2195,21 @@ var file_plugin_codegen_proto_goTypes = []interface{}{ (*Identifier)(nil), // 12: plugin.Identifier (*Column)(nil), // 13: plugin.Column (*Query)(nil), // 14: plugin.Query - (*Parameter)(nil), // 15: plugin.Parameter - (*CodeGenRequest)(nil), // 16: plugin.CodeGenRequest - (*CodeGenResponse)(nil), // 17: plugin.CodeGenResponse - (*VetParameter)(nil), // 18: plugin.VetParameter - (*VetConfig)(nil), // 19: plugin.VetConfig - (*VetQuery)(nil), // 20: plugin.VetQuery - nil, // 21: plugin.ParsedGoType.StructTagsEntry - nil, // 22: plugin.Settings.RenameEntry + (*CmdParams)(nil), // 15: plugin.CmdParams + (*Parameter)(nil), // 16: plugin.Parameter + (*CodeGenRequest)(nil), // 17: plugin.CodeGenRequest + (*CodeGenResponse)(nil), // 18: plugin.CodeGenResponse + (*VetParameter)(nil), // 19: plugin.VetParameter + (*VetConfig)(nil), // 20: plugin.VetConfig + (*VetQuery)(nil), // 21: plugin.VetQuery + nil, // 22: plugin.ParsedGoType.StructTagsEntry + nil, // 23: plugin.Settings.RenameEntry } var file_plugin_codegen_proto_depIdxs = []int32{ 12, // 0: plugin.Override.table:type_name -> plugin.Identifier 2, // 1: plugin.Override.go_type:type_name -> plugin.ParsedGoType - 21, // 2: plugin.ParsedGoType.struct_tags:type_name -> plugin.ParsedGoType.StructTagsEntry - 22, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry + 22, // 2: plugin.ParsedGoType.struct_tags:type_name -> plugin.ParsedGoType.StructTagsEntry + 23, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry 1, // 4: plugin.Settings.overrides:type_name -> plugin.Override 4, // 5: plugin.Settings.codegen:type_name -> plugin.Codegen 5, // 6: plugin.Settings.go:type_name -> plugin.GoCode @@ -2141,20 +2223,21 @@ var file_plugin_codegen_proto_depIdxs = []int32{ 12, // 14: plugin.Column.table:type_name -> plugin.Identifier 12, // 15: plugin.Column.type:type_name -> plugin.Identifier 12, // 16: plugin.Column.embed_table:type_name -> plugin.Identifier - 13, // 17: plugin.Query.columns:type_name -> plugin.Column - 15, // 18: plugin.Query.params:type_name -> plugin.Parameter - 12, // 19: plugin.Query.insert_into_table:type_name -> plugin.Identifier - 13, // 20: plugin.Parameter.column:type_name -> plugin.Column - 3, // 21: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 7, // 22: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 14, // 23: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 24: plugin.CodeGenResponse.files:type_name -> plugin.File - 18, // 25: plugin.VetQuery.params:type_name -> plugin.VetParameter - 26, // [26:26] is the sub-list for method output_type - 26, // [26:26] is the sub-list for method input_type - 26, // [26:26] is the sub-list for extension type_name - 26, // [26:26] is the sub-list for extension extendee - 0, // [0:26] is the sub-list for field type_name + 15, // 17: plugin.Query.cmd_params:type_name -> plugin.CmdParams + 13, // 18: plugin.Query.columns:type_name -> plugin.Column + 16, // 19: plugin.Query.params:type_name -> plugin.Parameter + 12, // 20: plugin.Query.insert_into_table:type_name -> plugin.Identifier + 13, // 21: plugin.Parameter.column:type_name -> plugin.Column + 3, // 22: plugin.CodeGenRequest.settings:type_name -> plugin.Settings + 7, // 23: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog + 14, // 24: plugin.CodeGenRequest.queries:type_name -> plugin.Query + 0, // 25: plugin.CodeGenResponse.files:type_name -> plugin.File + 19, // 26: plugin.VetQuery.params:type_name -> plugin.VetParameter + 27, // [27:27] is the sub-list for method output_type + 27, // [27:27] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -2344,7 +2427,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { + switch v := v.(*CmdParams); i { case 0: return &v.state case 1: @@ -2356,7 +2439,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenRequest); i { + switch v := v.(*Parameter); i { case 0: return &v.state case 1: @@ -2368,7 +2451,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenResponse); i { + switch v := v.(*CodeGenRequest); i { case 0: return &v.state case 1: @@ -2380,7 +2463,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VetParameter); i { + switch v := v.(*CodeGenResponse); i { case 0: return &v.state case 1: @@ -2392,7 +2475,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VetConfig); i { + switch v := v.(*VetParameter); i { case 0: return &v.state case 1: @@ -2404,6 +2487,18 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VetConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VetQuery); i { case 0: return &v.state @@ -2423,7 +2518,7 @@ func file_plugin_codegen_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 23, + NumMessages: 24, NumExtensions: 0, NumServices: 0, }, diff --git a/internal/plugin/codegen_vtproto.pb.go b/internal/plugin/codegen_vtproto.pb.go index d4f35041f2..ecfdb17f43 100644 --- a/internal/plugin/codegen_vtproto.pb.go +++ b/internal/plugin/codegen_vtproto.pb.go @@ -432,6 +432,7 @@ func (m *Query) CloneVT() *Query { Text: m.Text, Name: m.Name, Cmd: m.Cmd, + CmdParams: m.CmdParams.CloneVT(), Filename: m.Filename, InsertIntoTable: m.InsertIntoTable.CloneVT(), } @@ -465,6 +466,26 @@ func (m *Query) CloneMessageVT() proto.Message { return m.CloneVT() } +func (m *CmdParams) CloneVT() *CmdParams { + if m == nil { + return (*CmdParams)(nil) + } + r := &CmdParams{ + ManyKey: m.ManyKey, + InsertMultiple: m.InsertMultiple, + NoInference: m.NoInference, + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *CmdParams) CloneMessageVT() proto.Message { + return m.CloneVT() +} + func (m *Parameter) CloneVT() *Parameter { if m == nil { return (*Parameter)(nil) @@ -1303,6 +1324,9 @@ func (this *Query) EqualVT(that *Query) bool { if !this.InsertIntoTable.EqualVT(that.InsertIntoTable) { return false } + if !this.CmdParams.EqualVT(that.CmdParams) { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -1313,6 +1337,31 @@ func (this *Query) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } +func (this *CmdParams) EqualVT(that *CmdParams) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ManyKey != that.ManyKey { + return false + } + if this.InsertMultiple != that.InsertMultiple { + return false + } + if this.NoInference != that.NoInference { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *CmdParams) EqualMessageVT(thatMsg proto.Message) bool { + that, ok := thatMsg.(*CmdParams) + if !ok { + return false + } + return this.EqualVT(that) +} func (this *Parameter) EqualVT(that *Parameter) bool { if this == that { return true @@ -2833,6 +2882,16 @@ func (m *Query) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.CmdParams != nil { + size, err := m.CmdParams.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x4a + } if m.InsertIntoTable != nil { size, err := m.InsertIntoTable.MarshalToSizedBufferVT(dAtA[:i]) if err != nil { @@ -2907,6 +2966,66 @@ func (m *Query) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CmdParams) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CmdParams) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *CmdParams) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.NoInference { + i-- + if m.NoInference { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.InsertMultiple { + i-- + if m.InsertMultiple { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.ManyKey) > 0 { + i -= len(m.ManyKey) + copy(dAtA[i:], m.ManyKey) + i = encodeVarint(dAtA, i, uint64(len(m.ManyKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Parameter) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -4578,6 +4697,16 @@ func (m *Query) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.CmdParams != nil { + size, err := m.CmdParams.MarshalToSizedBufferVTStrict(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x4a + } if m.InsertIntoTable != nil { size, err := m.InsertIntoTable.MarshalToSizedBufferVTStrict(dAtA[:i]) if err != nil { @@ -4652,6 +4781,66 @@ func (m *Query) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CmdParams) MarshalVTStrict() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CmdParams) MarshalToVTStrict(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVTStrict(dAtA[:size]) +} + +func (m *CmdParams) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.NoInference { + i-- + if m.NoInference { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.InsertMultiple { + i-- + if m.InsertMultiple { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.ManyKey) > 0 { + i -= len(m.ManyKey) + copy(dAtA[i:], m.ManyKey) + i = encodeVarint(dAtA, i, uint64(len(m.ManyKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Parameter) MarshalVTStrict() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -5547,6 +5736,30 @@ func (m *Query) SizeVT() (n int) { l = m.InsertIntoTable.SizeVT() n += 1 + l + sov(uint64(l)) } + if m.CmdParams != nil { + l = m.CmdParams.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *CmdParams) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ManyKey) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + if m.InsertMultiple { + n += 2 + } + if m.NoInference { + n += 2 + } n += len(m.unknownFields) return n } @@ -9573,6 +9786,165 @@ func (m *Query) UnmarshalVT(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CmdParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.CmdParams == nil { + m.CmdParams = &CmdParams{} + } + if err := m.CmdParams.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CmdParams) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CmdParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CmdParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ManyKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ManyKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InsertMultiple", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.InsertMultiple = bool(v != 0) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NoInference", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.NoInference = bool(v != 0) default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index accecef017..67319cd3a5 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -179,6 +179,7 @@ message Query string text = 1 [json_name="text"]; string name = 2 [json_name="name"]; string cmd = 3 [json_name="cmd"]; + CmdParams cmd_params = 9 [json_name="cmd_params"]; repeated Column columns = 4 [json_name="columns"]; repeated Parameter params = 5 [json_name="parameters"]; repeated string comments = 6 [json_name="comments"]; @@ -186,6 +187,13 @@ message Query Identifier insert_into_table = 8 [json_name="insert_into_table"]; } +message CmdParams +{ + string many_key = 1 [json_name="many_key"]; + bool insert_multiple = 2 [json_name="insert_multiple"]; + bool no_inference = 3 [json_name="no_inference"]; +} + message Parameter { int32 number = 1 [json_name="number"]; @@ -225,4 +233,4 @@ message VetQuery string name = 2 [json_name="name"]; string cmd = 3 [json_name="cmd"]; repeated VetParameter params = 4 [json_name="parameters"]; -} \ No newline at end of file +}