From d3de3a8c3c3c828623d4e24131ff874b84558e89 Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Mon, 28 Feb 2022 18:00:21 -0600 Subject: [PATCH 1/7] move a lot of stuff --- internal/cmd/generate.go | 11 +- internal/codegen/golang/compat.go | 4 +- internal/codegen/golang/driver.go | 6 +- internal/codegen/golang/field.go | 4 +- internal/codegen/golang/gen.go | 43 +- internal/codegen/golang/go_type.go | 28 +- internal/codegen/golang/imports.go | 16 +- internal/codegen/golang/mysql_type.go | 20 +- internal/codegen/golang/postgresql_type.go | 11 +- internal/codegen/golang/query.go | 4 +- internal/codegen/golang/result.go | 85 ++-- internal/codegen/golang/sqlite_type.go | 4 +- internal/codegen/golang/struct.go | 4 +- internal/plugin/codegen.pb.go | 490 ++++++++++++++++----- internal/python/ast/ast.pb.go | 4 +- protos/plugin/codegen.proto | 25 ++ 16 files changed, 528 insertions(+), 231 deletions(-) diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 8823224636..fb160b170c 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -187,13 +187,12 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer if debug.Traced { region = trace.StartRegion(ctx, "codegen") } - var files map[string]string var resp *plugin.CodeGenResponse var out string switch { case sql.Gen.Go != nil: out = combo.Go.Out - files, err = golang.Generate(result, combo) + resp, err = golang.Generate(codeGenRequest(result, combo)) case sql.Gen.Kotlin != nil: out = combo.Kotlin.Out resp, err = kotlin.Generate(codeGenRequest(result, combo)) @@ -207,11 +206,9 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer region.End() } - if resp != nil { - files = map[string]string{} - for _, file := range resp.Files { - files[file.Name] = string(file.Contents) - } + files := map[string]string{} + for _, file := range resp.Files { + files[file.Name] = string(file.Contents) } if err != nil { diff --git a/internal/codegen/golang/compat.go b/internal/codegen/golang/compat.go index cdbb5aac2a..44b6d9549e 100644 --- a/internal/codegen/golang/compat.go +++ b/internal/codegen/golang/compat.go @@ -2,10 +2,10 @@ package golang import ( "github.com/kyleconroy/sqlc/internal/core" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func sameTableName(n *ast.TableName, f core.FQN, defaultSchema string) bool { +func sameTableName(n *plugin.Identifier, f core.FQN, defaultSchema string) bool { if n == nil { return false } diff --git a/internal/codegen/golang/driver.go b/internal/codegen/golang/driver.go index de2e201b8c..03485aab83 100644 --- a/internal/codegen/golang/driver.go +++ b/internal/codegen/golang/driver.go @@ -1,6 +1,8 @@ package golang -import "github.com/kyleconroy/sqlc/internal/config" +import ( + "github.com/kyleconroy/sqlc/internal/plugin" +) type SQLDriver int @@ -9,7 +11,7 @@ const ( SQLDriverLibPQ ) -func parseDriver(settings config.CombinedSettings) SQLDriver { +func parseDriver(settings *plugin.Settings) SQLDriver { if settings.Go.SQLPackage == "pgx/v4" { return SQLDriverPGXV4 } else { diff --git a/internal/codegen/golang/field.go b/internal/codegen/golang/field.go index bb095e8a62..be2f9caa30 100644 --- a/internal/codegen/golang/field.go +++ b/internal/codegen/golang/field.go @@ -5,7 +5,7 @@ import ( "sort" "strings" - "github.com/kyleconroy/sqlc/internal/config" + "github.com/kyleconroy/sqlc/internal/plugin" ) type Field struct { @@ -28,7 +28,7 @@ func (gf Field) Tag() string { return strings.Join(tags, " ") } -func JSONTagName(name string, settings config.CombinedSettings) string { +func JSONTagName(name string, settings *plugin.Settings) string { style := settings.Go.JSONTagsCaseStyle if style == "" || style == "none" { return name diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index 522cdb1b4f..82828855fc 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -10,9 +10,9 @@ import ( "text/template" "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/compiler" "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/metadata" + "github.com/kyleconroy/sqlc/internal/plugin" ) type Generateable interface { @@ -28,7 +28,6 @@ type tmplCtx struct { Enums []Enum Structs []Struct GoQueries []Query - Settings config.Config // TODO: Race conditions SourceName string @@ -47,19 +46,19 @@ func (t *tmplCtx) OutputQuery(sourceName string) bool { return t.SourceName == sourceName } -func Generate(r *compiler.Result, settings config.CombinedSettings) (map[string]string, error) { - enums := buildEnums(r, settings) - structs := buildStructs(r, settings) - queries, err := buildQueries(r, settings, structs) +func Generate(req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { + enums := buildEnums(req) + structs := buildStructs(req) + queries, err := buildQueries(req, structs) if err != nil { return nil, err } - return generate(settings, enums, structs, queries) + return generate(req, enums, structs, queries) } -func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, queries []Query) (map[string]string, error) { +func generate(req *plugin.CodeGenRequest, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { i := &importer{ - Settings: settings, + Settings: req.Settings, Queries: queries, Enums: enums, Structs: structs, @@ -83,18 +82,17 @@ func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, ), ) - golang := settings.Go + golang := req.Settings.Go tctx := tmplCtx{ - Settings: settings.Global, EmitInterface: golang.EmitInterface, - EmitJSONTags: golang.EmitJSONTags, - EmitDBTags: golang.EmitDBTags, + EmitJSONTags: golang.EmitJsonTags, + EmitDBTags: golang.EmitDbTags, EmitPreparedQueries: golang.EmitPreparedQueries, EmitEmptySlices: golang.EmitEmptySlices, - EmitMethodsWithDBArgument: golang.EmitMethodsWithDBArgument, + EmitMethodsWithDBArgument: golang.EmitMethodsWithDbArgument, UsesCopyFrom: usesCopyFrom(queries), UsesBatch: usesBatch(queries), - SQLPackage: SQLPackageFromString(golang.SQLPackage), + SQLPackage: SQLPackageFromString(golang.SqlPackage), Q: "`", Package: golang.Package, GoQueries: queries, @@ -139,8 +137,8 @@ func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, } dbFileName := "db.go" - if golang.OutputDBFileName != "" { - dbFileName = golang.OutputDBFileName + if golang.OutputDbFileName != "" { + dbFileName = golang.OutputDbFileName } modelsFileName := "models.go" if golang.OutputModelsFileName != "" { @@ -187,7 +185,16 @@ func generate(settings config.CombinedSettings, enums []Enum, structs []Struct, return nil, err } } - return output, nil + resp := plugin.CodeGenResponse{} + + for filename, code := range output { + resp.Files = append(resp.Files, &plugin.File{ + Name: filename, + Contents: []byte(code), + }) + } + + return &resp, nil } func usesCopyFrom(queries []Query) bool { diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index 718a8dca1c..dcd54f05f2 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -2,33 +2,33 @@ package golang import ( "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func goType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { +func goType(req *plugin.CodeGenRequest, col *compiler.Column) string { // Check if the column's type has been overridden - for _, oride := range settings.Overrides { + for _, oride := range req.Settings.Overrides { if oride.GoTypeName == "" { continue } - sameTable := oride.Matches(col.Table, r.Catalog.DefaultSchema) + sameTable := oride.Matches(col.Table, req.Catalog.DefaultSchema) if oride.Column != "" && oride.ColumnName.MatchString(col.Name) && sameTable { return oride.GoTypeName } } - typ := goInnerType(r, col, settings) + typ := goInnerType(req, col) if col.IsArray { return "[]" + typ } return typ } -func goInnerType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { +func goInnerType(req *plugin.CodeGenRequest, col *compiler.Column) string { columnType := col.DataType notNull := col.NotNull || col.IsArray // package overrides have a higher precedence - for _, oride := range settings.Overrides { + for _, oride := range req.Settings.Overrides { if oride.GoTypeName == "" { continue } @@ -38,13 +38,13 @@ func goInnerType(r *compiler.Result, col *compiler.Column, settings config.Combi } // TODO: Extend the engine interface to handle types - switch settings.Package.Engine { - case config.EngineMySQL: - return mysqlType(r, col, settings) - case config.EnginePostgreSQL: - return postgresType(r, col, settings) - case config.EngineXLemon: - return sqliteType(r, col, settings) + switch req.Settings.Engine { + case "mysql": + return mysqlType(req, col) + case "postgres": + return postgresType(req, col) + case "_lemon": + return sqliteType(req, col) default: return "interface{}" } diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index a17bd18d1e..e321dd0e55 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -5,8 +5,8 @@ import ( "sort" "strings" - "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/metadata" + "github.com/kyleconroy/sqlc/internal/plugin" ) type fileImports struct { @@ -58,7 +58,7 @@ func mergeImports(imps ...fileImports) [][]ImportSpec { } type importer struct { - Settings config.CombinedSettings + Settings *plugin.Settings Queries []Query Enums []Enum Structs []Struct @@ -78,8 +78,8 @@ func (i *importer) usesType(typ string) bool { func (i *importer) Imports(filename string) [][]ImportSpec { dbFileName := "db.go" - if i.Settings.Go.OutputDBFileName != "" { - dbFileName = i.Settings.Go.OutputDBFileName + if i.Settings.Go.OutputDbFileName != "" { + dbFileName = i.Settings.Go.OutputDbFileName } modelsFileName := "models.go" if i.Settings.Go.OutputModelsFileName != "" { @@ -114,7 +114,7 @@ func (i *importer) dbImports() fileImports { {Path: "context"}, } - sqlpkg := SQLPackageFromString(i.Settings.Go.SQLPackage) + sqlpkg := SQLPackageFromString(i.Settings.Go.SqlPackage) switch sqlpkg { case SQLPackagePGX: pkg = append(pkg, ImportSpec{Path: "github.com/jackc/pgconn"}) @@ -161,7 +161,7 @@ var pqtypeTypes = map[string]struct{}{ "pqtype.NullRawMessage": {}, } -func buildImports(settings config.CombinedSettings, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { +func buildImports(settings *plugin.Settings, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { pkg := make(map[ImportSpec]struct{}) std := make(map[string]struct{}) @@ -169,7 +169,7 @@ func buildImports(settings config.CombinedSettings, queries []Query, uses func(s std["database/sql"] = struct{}{} } - sqlpkg := SQLPackageFromString(settings.Go.SQLPackage) + sqlpkg := SQLPackageFromString(settings.Go.SqlPackage) for _, q := range queries { if q.Cmd == metadata.CmdExecResult { switch sqlpkg { @@ -366,7 +366,7 @@ func (i *importer) queryImports(filename string) fileImports { std["context"] = struct{}{} } - sqlpkg := SQLPackageFromString(i.Settings.Go.SQLPackage) + sqlpkg := SQLPackageFromString(i.Settings.Go.SqlPackage) if sliceScan() && sqlpkg != SQLPackagePGX { pkg[ImportSpec{Path: "github.com/lib/pq"}] = struct{}{} } diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index 4a56d64f23..8221a6f273 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -4,12 +4,11 @@ import ( "log" "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/debug" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func mysqlType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { +func mysqlType(req *plugin.CodeGenRequest, col *compiler.Column) string { columnType := col.DataType notNull := col.NotNull || col.IsArray @@ -84,16 +83,13 @@ func mysqlType(r *compiler.Result, col *compiler.Column, settings config.Combine return "interface{}" default: - for _, schema := range r.Catalog.Schemas { - for _, typ := range schema.Types { - switch t := typ.(type) { - case *catalog.Enum: - if t.Name == columnType { - if schema.Name == r.Catalog.DefaultSchema { - return StructName(t.Name, settings) - } - return StructName(schema.Name+"_"+t.Name, settings) + for _, schema := range req.Catalog.Schemas { + for _, enum := range schema.Enums { + if enum.Name == columnType { + if schema.Name == req.Catalog.DefaultSchema { + return StructName(enum.Name, req.Settings) } + return StructName(schema.Name+"_"+enum.Name, req.Settings) } } } diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index 1ecb989ebd..5c9fada528 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -4,15 +4,15 @@ import ( "log" "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/debug" + "github.com/kyleconroy/sqlc/internal/plugin" "github.com/kyleconroy/sqlc/internal/sql/catalog" ) -func postgresType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { +func postgresType(req *plugin.CodeGenRequest, col *compiler.Column) string { columnType := col.DataType notNull := col.NotNull || col.IsArray - driver := parseDriver(settings) + driver := parseDriver(req.Settings) switch columnType { case "serial", "serial4", "pg_catalog.serial4": @@ -246,10 +246,10 @@ func postgresType(r *compiler.Result, col *compiler.Column, settings config.Comb return "interface{}" } if rel.Schema == "" { - rel.Schema = r.Catalog.DefaultSchema + rel.Schema = req.Catalog.DefaultSchema } - for _, schema := range r.Catalog.Schemas { + for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" { continue } @@ -263,6 +263,7 @@ func postgresType(r *compiler.Result, col *compiler.Column, settings config.Comb return StructName(schema.Name+"_"+t.Name, settings) } case *catalog.CompositeType: + // ???????? if notNull { return "string" } diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index f4ce648cd3..2eed835c6f 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/kyleconroy/sqlc/internal/metadata" - "github.com/kyleconroy/sqlc/internal/sql/ast" + "github.com/kyleconroy/sqlc/internal/plugin" ) type QueryValue struct { @@ -161,7 +161,7 @@ type Query struct { Ret QueryValue Arg QueryValue // Used for :copyfrom - Table *ast.TableName + Table *plugin.Identifier } func (q Query) hasRetType() bool { diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 0a0d536e4f..a419676216 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -7,31 +7,26 @@ import ( "github.com/kyleconroy/sqlc/internal/codegen" "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/core" "github.com/kyleconroy/sqlc/internal/inflection" - "github.com/kyleconroy/sqlc/internal/sql/catalog" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func buildEnums(r *compiler.Result, settings config.CombinedSettings) []Enum { +func buildEnums(req *plugin.CodeGenRequest) []Enum { var enums []Enum - for _, schema := range r.Catalog.Schemas { + for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" { continue } - for _, typ := range schema.Types { - enum, ok := typ.(*catalog.Enum) - if !ok { - continue - } + for _, enum := range schema.Enums { var enumName string - if schema.Name == r.Catalog.DefaultSchema { + if schema.Name == req.Catalog.DefaultSchema { enumName = enum.Name } else { enumName = schema.Name + "_" + enum.Name } e := Enum{ - Name: StructName(enumName, settings), + Name: StructName(enumName, req.Settings), Comment: enum.Comment, } seen := make(map[string]struct{}, len(enum.Vals)) @@ -41,7 +36,7 @@ func buildEnums(r *compiler.Result, settings config.CombinedSettings) []Enum { value = fmt.Sprintf("value_%d", i) } e.Constants = append(e.Constants, Constant{ - Name: StructName(enumName+"_"+value, settings), + Name: StructName(enumName+"_"+value, req.Settings), Value: v, Type: e.Name, }) @@ -56,39 +51,39 @@ func buildEnums(r *compiler.Result, settings config.CombinedSettings) []Enum { return enums } -func buildStructs(r *compiler.Result, settings config.CombinedSettings) []Struct { +func buildStructs(req *plugin.CodeGenRequest) []Struct { var structs []Struct - for _, schema := range r.Catalog.Schemas { + for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" { continue } for _, table := range schema.Tables { var tableName string - if schema.Name == r.Catalog.DefaultSchema { + if schema.Name == req.Catalog.DefaultSchema { tableName = table.Rel.Name } else { tableName = schema.Name + "_" + table.Rel.Name } structName := tableName - if !settings.Go.EmitExactTableNames { + if !req.Settings.Go.EmitExactTableNames { structName = inflection.Singular(structName) } s := Struct{ Table: core.FQN{Schema: schema.Name, Rel: table.Rel.Name}, - Name: StructName(structName, settings), + Name: StructName(structName, req.Settings), Comment: table.Comment, } for _, column := range table.Columns { tags := map[string]string{} - if settings.Go.EmitDBTags { + if req.Settings.Go.EmitDbTags { tags["db:"] = column.Name } - if settings.Go.EmitJSONTags { - tags["json:"] = JSONTagName(column.Name, settings) + if req.Settings.Go.EmitJsonTags { + tags["json:"] = JSONTagName(column.Name, req.Settings) } s.Fields = append(s.Fields, Field{ - Name: StructName(column.Name, settings), - Type: goType(r, compiler.ConvertColumn(table.Rel, column), settings), + Name: StructName(column.Name, req.Settings), + Type: goType(req, column), Tags: tags, Comment: column.Comment, }) @@ -114,7 +109,7 @@ func columnName(c *compiler.Column, pos int) string { return fmt.Sprintf("column_%d", pos+1) } -func paramName(p compiler.Parameter) string { +func paramName(p *plugin.Parameter) string { if p.Column.Name != "" { return argName(p.Column.Name) } @@ -135,9 +130,9 @@ func argName(name string) string { return out } -func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs []Struct) ([]Query, error) { - qs := make([]Query, 0, len(r.Queries)) - for _, query := range r.Queries { +func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) { + qs := make([]Query, 0, len(req.Queries)) + for _, query := range req.Queries { if query.Name == "" { continue } @@ -146,7 +141,7 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs } var constantName string - if settings.Go.EmitExportedQueries { + if req.Settings.Go.EmitExportedQueries { constantName = codegen.Title(query.Name) } else { constantName = codegen.LowerTitle(query.Name) @@ -158,28 +153,28 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs FieldName: codegen.LowerTitle(query.Name) + "Stmt", MethodName: query.Name, SourceName: query.Filename, - SQL: query.SQL, + SQL: query.Text, Comments: query.Comments, Table: query.InsertIntoTable, } - sqlpkg := SQLPackageFromString(settings.Go.SQLPackage) + sqlpkg := SQLPackageFromString(req.Settings.Go.SqlPackage) if len(query.Params) == 1 { p := query.Params[0] gq.Arg = QueryValue{ Name: paramName(p), - Typ: goType(r, p.Column, settings), + Typ: goType(req, p.Column), SQLPackage: sqlpkg, } } else if len(query.Params) > 1 { var cols []goColumn for _, p := range query.Params { cols = append(cols, goColumn{ - id: p.Number, + id: int(p.Number), // XXX: ?? Column: p.Column, }) } - s, err := columnsToStruct(r, gq.MethodName+"Params", cols, settings, false) + s, err := columnsToStruct(req, gq.MethodName+"Params", cols, false) if err != nil { return nil, err } @@ -188,7 +183,7 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs Name: "arg", Struct: s, SQLPackage: sqlpkg, - EmitPointer: settings.Go.EmitParamsStructPointers, + EmitPointer: req.Settings.Go.EmitParamsStructPointers, } } @@ -200,7 +195,7 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs } gq.Ret = QueryValue{ Name: name, - Typ: goType(r, c, settings), + Typ: goType(req, c), SQLPackage: sqlpkg, } } else if len(query.Columns) > 1 { @@ -214,9 +209,9 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs same := true for i, f := range s.Fields { c := query.Columns[i] - sameName := f.Name == StructName(columnName(c, i), settings) - sameType := f.Type == goType(r, c, settings) - sameTable := sameTableName(c.Table, s.Table, r.Catalog.DefaultSchema) + sameName := f.Name == StructName(columnName(c, i), req.Settings) + sameType := f.Type == goType(req, c) + sameTable := sameTableName(c.Table, s.Table, req.Catalog.DefaultSchema) if !sameName || !sameType || !sameTable { same = false } @@ -236,7 +231,7 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs }) } var err error - gs, err = columnsToStruct(r, gq.MethodName+"Row", columns, settings, true) + gs, err = columnsToStruct(req, gq.MethodName+"Row", columns, true) if err != nil { return nil, err } @@ -247,7 +242,7 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs Name: "i", Struct: gs, SQLPackage: sqlpkg, - EmitPointer: settings.Go.EmitResultStructPointers, + EmitPointer: req.Settings.Go.EmitResultStructPointers, } } @@ -264,7 +259,7 @@ func buildQueries(r *compiler.Result, settings config.CombinedSettings, structs // JSON tags: count, count_2, count_2 // // This is unlikely to happen, so don't fix it yet -func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settings config.CombinedSettings, useID bool) (*Struct, error) { +func columnsToStruct(req *plugin.CodeGenRequest, name string, columns []goColumn, useID bool) (*Struct, error) { gs := Struct{ Name: name, } @@ -273,7 +268,7 @@ func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settin for i, c := range columns { colName := columnName(c.Column, i) tagName := colName - fieldName := StructName(colName, settings) + fieldName := StructName(colName, req.Settings) baseFieldName := fieldName // Track suffixes by the ID of the column, so that columns referring to the same numbered parameter can be // reused. @@ -289,16 +284,16 @@ func columnsToStruct(r *compiler.Result, name string, columns []goColumn, settin fieldName = fmt.Sprintf("%s_%d", fieldName, suffix) } tags := map[string]string{} - if settings.Go.EmitDBTags { + if req.Settings.Go.EmitDbTags { tags["db:"] = tagName } - if settings.Go.EmitJSONTags { - tags["json:"] = JSONTagName(tagName, settings) + if req.Settings.Go.EmitJsonTags { + tags["json:"] = JSONTagName(tagName, req.Settings) } gs.Fields = append(gs.Fields, Field{ Name: fieldName, DBName: colName, - Type: goType(r, c.Column, settings), + Type: goType(req, c.Column), Tags: tags, }) if _, found := seen[baseFieldName]; !found { diff --git a/internal/codegen/golang/sqlite_type.go b/internal/codegen/golang/sqlite_type.go index bb8fcc0735..887928f104 100644 --- a/internal/codegen/golang/sqlite_type.go +++ b/internal/codegen/golang/sqlite_type.go @@ -5,10 +5,10 @@ import ( "strings" "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func sqliteType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { +func sqliteType(req *plugin.CodeGenRequest, col *compiler.Column) string { dt := strings.ToLower(col.DataType) notNull := col.NotNull || col.IsArray diff --git a/internal/codegen/golang/struct.go b/internal/codegen/golang/struct.go index 74be48e3f3..f5b96e1ffe 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -3,8 +3,8 @@ package golang import ( "strings" - "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/core" + "github.com/kyleconroy/sqlc/internal/plugin" ) type Struct struct { @@ -14,7 +14,7 @@ type Struct struct { Comment string } -func StructName(name string, settings config.CombinedSettings) string { +func StructName(name string, settings *plugin.Settings) string { if rename := settings.Rename[name]; rename != "" { return rename } diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 9baf30ae11..e23c651ca9 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.26.0 +// protoc v3.17.3 // source: plugin/codegen.proto package plugin @@ -243,6 +243,7 @@ type Settings struct { // TODO: Refactor codegen settings Python *PythonCode `protobuf:"bytes,8,opt,name=python,proto3" json:"python,omitempty"` Kotlin *KotlinCode `protobuf:"bytes,9,opt,name=kotlin,proto3" json:"kotlin,omitempty"` + Go *GoCode `protobuf:"bytes,10,opt,name=go,proto3" json:"go,omitempty"` } func (x *Settings) Reset() { @@ -333,6 +334,13 @@ func (x *Settings) GetKotlin() *KotlinCode { return nil } +func (x *Settings) GetGo() *GoCode { + if x != nil { + return x.Go + } + return nil +} + type PythonCode struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -475,6 +483,190 @@ func (x *KotlinCode) GetOut() string { return "" } +type GoCode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EmitInterface bool `protobuf:"varint,1,opt,name=emit_interface,json=emitInterface,proto3" json:"emit_interface,omitempty"` + EmitJsonTags bool `protobuf:"varint,2,opt,name=emit_json_tags,json=emitJsonTags,proto3" json:"emit_json_tags,omitempty"` + EmitDbTags bool `protobuf:"varint,3,opt,name=emit_db_tags,json=emitDbTags,proto3" json:"emit_db_tags,omitempty"` + EmitPreparedQueries bool `protobuf:"varint,4,opt,name=emit_prepared_queries,json=emitPreparedQueries,proto3" json:"emit_prepared_queries,omitempty"` + EmitExactTableNames bool `protobuf:"varint,5,opt,name=emit_exact_table_names,json=emitExactTableNames,proto3" json:"emit_exact_table_names,omitempty"` + EmitEmptySlices bool `protobuf:"varint,6,opt,name=emit_empty_slices,json=emitEmptySlices,proto3" json:"emit_empty_slices,omitempty"` + EmitExportedQueries bool `protobuf:"varint,7,opt,name=emit_exported_queries,json=emitExportedQueries,proto3" json:"emit_exported_queries,omitempty"` + EmitResultStructPointers bool `protobuf:"varint,8,opt,name=emit_result_struct_pointers,json=emitResultStructPointers,proto3" json:"emit_result_struct_pointers,omitempty"` + EmitParamsStructPointers bool `protobuf:"varint,9,opt,name=emit_params_struct_pointers,json=emitParamsStructPointers,proto3" json:"emit_params_struct_pointers,omitempty"` + EmitMethodsWithDbArgument bool `protobuf:"varint,10,opt,name=emit_methods_with_db_argument,json=emitMethodsWithDbArgument,proto3" json:"emit_methods_with_db_argument,omitempty"` + JsonTagsCaseStyle string `protobuf:"bytes,11,opt,name=json_tags_case_style,json=jsonTagsCaseStyle,proto3" json:"json_tags_case_style,omitempty"` + Package string `protobuf:"bytes,12,opt,name=package,proto3" json:"package,omitempty"` + Out string `protobuf:"bytes,13,opt,name=out,proto3" json:"out,omitempty"` + // XXX: overrides, rename, is part of the parent? + SqlPackage string `protobuf:"bytes,14,opt,name=sql_package,json=sqlPackage,proto3" json:"sql_package,omitempty"` + OutputDbFileName string `protobuf:"bytes,15,opt,name=output_db_file_name,json=outputDbFileName,proto3" json:"output_db_file_name,omitempty"` + OutputModelsFileName string `protobuf:"bytes,16,opt,name=output_models_file_name,json=outputModelsFileName,proto3" json:"output_models_file_name,omitempty"` + OutputQuerierFileName string `protobuf:"bytes,17,opt,name=output_querier_file_name,json=outputQuerierFileName,proto3" json:"output_querier_file_name,omitempty"` + OutputFilesSuffix string `protobuf:"bytes,18,opt,name=output_files_suffix,json=outputFilesSuffix,proto3" json:"output_files_suffix,omitempty"` +} + +func (x *GoCode) Reset() { + *x = GoCode{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GoCode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GoCode) ProtoMessage() {} + +func (x *GoCode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[6] + 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 GoCode.ProtoReflect.Descriptor instead. +func (*GoCode) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{6} +} + +func (x *GoCode) GetEmitInterface() bool { + if x != nil { + return x.EmitInterface + } + return false +} + +func (x *GoCode) GetEmitJsonTags() bool { + if x != nil { + return x.EmitJsonTags + } + return false +} + +func (x *GoCode) GetEmitDbTags() bool { + if x != nil { + return x.EmitDbTags + } + return false +} + +func (x *GoCode) GetEmitPreparedQueries() bool { + if x != nil { + return x.EmitPreparedQueries + } + return false +} + +func (x *GoCode) GetEmitExactTableNames() bool { + if x != nil { + return x.EmitExactTableNames + } + return false +} + +func (x *GoCode) GetEmitEmptySlices() bool { + if x != nil { + return x.EmitEmptySlices + } + return false +} + +func (x *GoCode) GetEmitExportedQueries() bool { + if x != nil { + return x.EmitExportedQueries + } + return false +} + +func (x *GoCode) GetEmitResultStructPointers() bool { + if x != nil { + return x.EmitResultStructPointers + } + return false +} + +func (x *GoCode) GetEmitParamsStructPointers() bool { + if x != nil { + return x.EmitParamsStructPointers + } + return false +} + +func (x *GoCode) GetEmitMethodsWithDbArgument() bool { + if x != nil { + return x.EmitMethodsWithDbArgument + } + return false +} + +func (x *GoCode) GetJsonTagsCaseStyle() string { + if x != nil { + return x.JsonTagsCaseStyle + } + return "" +} + +func (x *GoCode) GetPackage() string { + if x != nil { + return x.Package + } + return "" +} + +func (x *GoCode) GetOut() string { + if x != nil { + return x.Out + } + return "" +} + +func (x *GoCode) GetSqlPackage() string { + if x != nil { + return x.SqlPackage + } + return "" +} + +func (x *GoCode) GetOutputDbFileName() string { + if x != nil { + return x.OutputDbFileName + } + return "" +} + +func (x *GoCode) GetOutputModelsFileName() string { + if x != nil { + return x.OutputModelsFileName + } + return "" +} + +func (x *GoCode) GetOutputQuerierFileName() string { + if x != nil { + return x.OutputQuerierFileName + } + return "" +} + +func (x *GoCode) GetOutputFilesSuffix() string { + if x != nil { + return x.OutputFilesSuffix + } + return "" +} + type Catalog struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -489,7 +681,7 @@ type Catalog struct { func (x *Catalog) Reset() { *x = Catalog{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -502,7 +694,7 @@ func (x *Catalog) String() string { func (*Catalog) ProtoMessage() {} func (x *Catalog) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -515,7 +707,7 @@ func (x *Catalog) ProtoReflect() protoreflect.Message { // Deprecated: Use Catalog.ProtoReflect.Descriptor instead. func (*Catalog) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{6} + return file_plugin_codegen_proto_rawDescGZIP(), []int{7} } func (x *Catalog) GetComment() string { @@ -560,7 +752,7 @@ type Schema struct { func (x *Schema) Reset() { *x = Schema{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -573,7 +765,7 @@ func (x *Schema) String() string { func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -586,7 +778,7 @@ func (x *Schema) ProtoReflect() protoreflect.Message { // Deprecated: Use Schema.ProtoReflect.Descriptor instead. func (*Schema) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{7} + return file_plugin_codegen_proto_rawDescGZIP(), []int{8} } func (x *Schema) GetComment() string { @@ -630,7 +822,7 @@ type Enum struct { func (x *Enum) Reset() { *x = Enum{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -643,7 +835,7 @@ func (x *Enum) String() string { func (*Enum) ProtoMessage() {} func (x *Enum) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -656,7 +848,7 @@ func (x *Enum) ProtoReflect() protoreflect.Message { // Deprecated: Use Enum.ProtoReflect.Descriptor instead. func (*Enum) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{8} + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} } func (x *Enum) GetName() string { @@ -693,7 +885,7 @@ type Table struct { func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -706,7 +898,7 @@ func (x *Table) String() string { func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -719,7 +911,7 @@ func (x *Table) ProtoReflect() protoreflect.Message { // Deprecated: Use Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{9} + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} } func (x *Table) GetRel() *Identifier { @@ -756,7 +948,7 @@ type Identifier struct { func (x *Identifier) Reset() { *x = Identifier{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -769,7 +961,7 @@ func (x *Identifier) String() string { func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -782,7 +974,7 @@ func (x *Identifier) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier.ProtoReflect.Descriptor instead. func (*Identifier) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{10} + return file_plugin_codegen_proto_rawDescGZIP(), []int{11} } func (x *Identifier) GetCatalog() string { @@ -829,7 +1021,7 @@ type Column struct { func (x *Column) Reset() { *x = Column{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -842,7 +1034,7 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -855,7 +1047,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{11} + return file_plugin_codegen_proto_rawDescGZIP(), []int{12} } func (x *Column) GetName() string { @@ -947,19 +1139,20 @@ type Query struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - 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"` - 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"` - Filename string `protobuf:"bytes,7,opt,name=filename,proto3" json:"filename,omitempty"` + 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"` + 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"` + Filename string `protobuf:"bytes,7,opt,name=filename,proto3" json:"filename,omitempty"` + InsertIntoTable *Identifier `protobuf:"bytes,8,opt,name=InsertIntoTable,proto3" json:"InsertIntoTable,omitempty"` } func (x *Query) Reset() { *x = Query{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -972,7 +1165,7 @@ func (x *Query) String() string { func (*Query) ProtoMessage() {} func (x *Query) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -985,7 +1178,7 @@ func (x *Query) ProtoReflect() protoreflect.Message { // Deprecated: Use Query.ProtoReflect.Descriptor instead. func (*Query) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{12} + return file_plugin_codegen_proto_rawDescGZIP(), []int{13} } func (x *Query) GetText() string { @@ -1037,6 +1230,13 @@ func (x *Query) GetFilename() string { return "" } +func (x *Query) GetInsertIntoTable() *Identifier { + if x != nil { + return x.InsertIntoTable + } + return nil +} + type Parameter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1049,7 +1249,7 @@ type Parameter struct { func (x *Parameter) Reset() { *x = Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1062,7 +1262,7 @@ func (x *Parameter) String() string { func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1075,7 +1275,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{13} + return file_plugin_codegen_proto_rawDescGZIP(), []int{14} } func (x *Parameter) GetNumber() int32 { @@ -1105,7 +1305,7 @@ type CodeGenRequest struct { func (x *CodeGenRequest) Reset() { *x = CodeGenRequest{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1118,7 +1318,7 @@ func (x *CodeGenRequest) String() string { func (*CodeGenRequest) ProtoMessage() {} func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1131,7 +1331,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{14} + return file_plugin_codegen_proto_rawDescGZIP(), []int{15} } func (x *CodeGenRequest) GetSettings() *Settings { @@ -1166,7 +1366,7 @@ type CodeGenResponse struct { func (x *CodeGenResponse) Reset() { *x = CodeGenResponse{} 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) } @@ -1179,7 +1379,7 @@ func (x *CodeGenResponse) String() string { func (*CodeGenResponse) ProtoMessage() {} func (x *CodeGenResponse) 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 { @@ -1192,7 +1392,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{15} + return file_plugin_codegen_proto_rawDescGZIP(), []int{16} } func (x *CodeGenResponse) GetFiles() []*File { @@ -1229,7 +1429,7 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x22, 0x38, 0x0a, 0x0a, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xe7, 0x02, 0x0a, 0x08, 0x53, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x87, 0x03, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 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, @@ -1248,7 +1448,9 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x64, - 0x65, 0x52, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x6e, + 0x65, 0x52, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x02, 0x67, 0x6f, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, + 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x02, 0x67, 0x6f, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, @@ -1271,7 +1473,60 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x69, 0x74, 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, - 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x22, 0x88, 0x01, + 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x22, 0xcd, 0x06, + 0x0a, 0x06, 0x47, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, + 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0d, 0x65, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, + 0x24, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6d, 0x69, 0x74, 0x4a, 0x73, 0x6f, + 0x6e, 0x54, 0x61, 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x64, 0x62, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x65, 0x6d, 0x69, + 0x74, 0x44, 0x62, 0x54, 0x61, 0x67, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6d, 0x69, 0x74, 0x5f, + 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x65, 0x70, + 0x61, 0x72, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x65, + 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, + 0x74, 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, + 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x73, + 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6d, 0x69, + 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, + 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x71, 0x75, + 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, + 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, + 0x12, 0x3d, 0x0a, 0x1b, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, + 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, + 0x3d, 0x0a, 0x1b, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x73, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x40, + 0x0a, 0x1d, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x5f, 0x77, + 0x69, 0x74, 0x68, 0x5f, 0x64, 0x62, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x65, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x73, 0x57, 0x69, 0x74, 0x68, 0x44, 0x62, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x2f, 0x0a, 0x14, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x5f, 0x63, 0x61, + 0x73, 0x65, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, + 0x6a, 0x73, 0x6f, 0x6e, 0x54, 0x61, 0x67, 0x73, 0x43, 0x61, 0x73, 0x65, 0x53, 0x74, 0x79, 0x6c, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, + 0x75, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x73, 0x71, 0x6c, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x73, 0x71, 0x6c, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x2d, + 0x0a, 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x64, 0x62, 0x5f, 0x66, 0x69, 0x6c, 0x65, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x75, 0x74, + 0x70, 0x75, 0x74, 0x44, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, + 0x17, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x5f, 0x66, + 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, + 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x71, + 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x51, 0x75, + 0x65, 0x72, 0x69, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, + 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x73, 0x75, + 0x66, 0x66, 0x69, 0x78, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x22, 0x88, 0x01, 0x0a, 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, @@ -1329,7 +1584,7 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x22, 0xd2, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x65, 0x22, 0x90, 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, @@ -1342,28 +1597,32 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 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, 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, 0x92, 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, 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, - 0x42, 0x2c, 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, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3c, 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, + 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, + 0x54, 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, 0x92, 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, 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, 0x42, 0x2c, + 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, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1378,7 +1637,7 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_plugin_codegen_proto_goTypes = []interface{}{ (*File)(nil), // 0: plugin.File (*Override)(nil), // 1: plugin.Override @@ -1386,44 +1645,47 @@ var file_plugin_codegen_proto_goTypes = []interface{}{ (*Settings)(nil), // 3: plugin.Settings (*PythonCode)(nil), // 4: plugin.PythonCode (*KotlinCode)(nil), // 5: plugin.KotlinCode - (*Catalog)(nil), // 6: plugin.Catalog - (*Schema)(nil), // 7: plugin.Schema - (*Enum)(nil), // 8: plugin.Enum - (*Table)(nil), // 9: plugin.Table - (*Identifier)(nil), // 10: plugin.Identifier - (*Column)(nil), // 11: plugin.Column - (*Query)(nil), // 12: plugin.Query - (*Parameter)(nil), // 13: plugin.Parameter - (*CodeGenRequest)(nil), // 14: plugin.CodeGenRequest - (*CodeGenResponse)(nil), // 15: plugin.CodeGenResponse - nil, // 16: plugin.Settings.RenameEntry + (*GoCode)(nil), // 6: plugin.GoCode + (*Catalog)(nil), // 7: plugin.Catalog + (*Schema)(nil), // 8: plugin.Schema + (*Enum)(nil), // 9: plugin.Enum + (*Table)(nil), // 10: plugin.Table + (*Identifier)(nil), // 11: plugin.Identifier + (*Column)(nil), // 12: plugin.Column + (*Query)(nil), // 13: plugin.Query + (*Parameter)(nil), // 14: plugin.Parameter + (*CodeGenRequest)(nil), // 15: plugin.CodeGenRequest + (*CodeGenResponse)(nil), // 16: plugin.CodeGenResponse + nil, // 17: plugin.Settings.RenameEntry } var file_plugin_codegen_proto_depIdxs = []int32{ - 10, // 0: plugin.Override.table:type_name -> plugin.Identifier + 11, // 0: plugin.Override.table:type_name -> plugin.Identifier 2, // 1: plugin.Override.python_type:type_name -> plugin.PythonType - 16, // 2: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry + 17, // 2: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry 1, // 3: plugin.Settings.overrides:type_name -> plugin.Override 4, // 4: plugin.Settings.python:type_name -> plugin.PythonCode 5, // 5: plugin.Settings.kotlin:type_name -> plugin.KotlinCode - 7, // 6: plugin.Catalog.schemas:type_name -> plugin.Schema - 9, // 7: plugin.Schema.tables:type_name -> plugin.Table - 8, // 8: plugin.Schema.enums:type_name -> plugin.Enum - 10, // 9: plugin.Table.rel:type_name -> plugin.Identifier - 11, // 10: plugin.Table.columns:type_name -> plugin.Column - 10, // 11: plugin.Column.table:type_name -> plugin.Identifier - 10, // 12: plugin.Column.type:type_name -> plugin.Identifier - 11, // 13: plugin.Query.columns:type_name -> plugin.Column - 13, // 14: plugin.Query.params:type_name -> plugin.Parameter - 11, // 15: plugin.Parameter.column:type_name -> plugin.Column - 3, // 16: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 6, // 17: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 12, // 18: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 19: plugin.CodeGenResponse.files:type_name -> plugin.File - 20, // [20:20] is the sub-list for method output_type - 20, // [20:20] is the sub-list for method input_type - 20, // [20:20] is the sub-list for extension type_name - 20, // [20:20] is the sub-list for extension extendee - 0, // [0:20] is the sub-list for field type_name + 6, // 6: plugin.Settings.go:type_name -> plugin.GoCode + 8, // 7: plugin.Catalog.schemas:type_name -> plugin.Schema + 10, // 8: plugin.Schema.tables:type_name -> plugin.Table + 9, // 9: plugin.Schema.enums:type_name -> plugin.Enum + 11, // 10: plugin.Table.rel:type_name -> plugin.Identifier + 12, // 11: plugin.Table.columns:type_name -> plugin.Column + 11, // 12: plugin.Column.table:type_name -> plugin.Identifier + 11, // 13: plugin.Column.type:type_name -> plugin.Identifier + 12, // 14: plugin.Query.columns:type_name -> plugin.Column + 14, // 15: plugin.Query.params:type_name -> plugin.Parameter + 11, // 16: plugin.Query.InsertIntoTable:type_name -> plugin.Identifier + 12, // 17: plugin.Parameter.column:type_name -> plugin.Column + 3, // 18: plugin.CodeGenRequest.settings:type_name -> plugin.Settings + 7, // 19: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog + 13, // 20: plugin.CodeGenRequest.queries:type_name -> plugin.Query + 0, // 21: plugin.CodeGenResponse.files:type_name -> plugin.File + 22, // [22:22] is the sub-list for method output_type + 22, // [22:22] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -1505,7 +1767,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Catalog); i { + switch v := v.(*GoCode); i { case 0: return &v.state case 1: @@ -1517,7 +1779,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { + switch v := v.(*Catalog); i { case 0: return &v.state case 1: @@ -1529,7 +1791,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Enum); i { + switch v := v.(*Schema); i { case 0: return &v.state case 1: @@ -1541,7 +1803,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { + switch v := v.(*Enum); i { case 0: return &v.state case 1: @@ -1553,7 +1815,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { + switch v := v.(*Table); i { case 0: return &v.state case 1: @@ -1565,7 +1827,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { + switch v := v.(*Identifier); i { case 0: return &v.state case 1: @@ -1577,7 +1839,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { + switch v := v.(*Column); i { case 0: return &v.state case 1: @@ -1589,7 +1851,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { + switch v := v.(*Query); i { case 0: return &v.state case 1: @@ -1601,7 +1863,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenRequest); i { + switch v := v.(*Parameter); i { case 0: return &v.state case 1: @@ -1613,6 +1875,18 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeGenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CodeGenResponse); i { case 0: return &v.state @@ -1631,7 +1905,7 @@ func file_plugin_codegen_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 17, + NumMessages: 18, NumExtensions: 0, NumServices: 0, }, diff --git a/internal/python/ast/ast.pb.go b/internal/python/ast/ast.pb.go index fee7ed4ad9..215335a1b3 100644 --- a/internal/python/ast/ast.pb.go +++ b/internal/python/ast/ast.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.1 +// protoc-gen-go v1.26.0 +// protoc v3.17.3 // source: python/ast.proto package ast diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index 252d24ecd8..b85354e694 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -49,6 +49,7 @@ message Settings // TODO: Refactor codegen settings PythonCode python = 8; KotlinCode kotlin = 9; + GoCode go = 10; } message PythonCode @@ -67,6 +68,29 @@ message KotlinCode string out = 3; } +message GoCode +{ + bool emit_interface = 1; + bool emit_json_tags = 2; + bool emit_db_tags = 3; + bool emit_prepared_queries = 4; + bool emit_exact_table_names = 5; + bool emit_empty_slices = 6; + bool emit_exported_queries = 7; + bool emit_result_struct_pointers = 8; + bool emit_params_struct_pointers = 9; + bool emit_methods_with_db_argument = 10; + string json_tags_case_style = 11; + string package = 12; + string out = 13; + // XXX: overrides, rename, is part of the parent? + string sql_package = 14; + string output_db_file_name = 15; + string output_models_file_name = 16; + string output_querier_file_name = 17; + string output_files_suffix = 18; +} + message Catalog { string comment = 1; @@ -131,6 +155,7 @@ message Query repeated Parameter params = 5 [json_name="parameters"]; repeated string comments = 6 [json_name="comments"]; string filename = 7 [json_name="filename"]; + Identifier InsertIntoTable = 8; } message Parameter From 9367b8242cf980e63ca6e650b632be12f24ea7d8 Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Mon, 28 Feb 2022 20:25:33 -0600 Subject: [PATCH 2/7] more --- internal/cmd/generate.go | 6 +- internal/cmd/shim.go | 38 ++ internal/codegen/golang/driver.go | 2 +- internal/codegen/golang/field.go | 2 +- internal/codegen/golang/go_type.go | 66 +- internal/codegen/golang/imports.go | 14 +- internal/codegen/golang/mysql_type.go | 16 +- internal/codegen/golang/postgresql_type.go | 32 +- internal/codegen/golang/query.go | 4 + internal/codegen/golang/result.go | 10 +- internal/codegen/golang/sqlite_type.go | 5 +- internal/plugin/codegen.pb.go | 698 ++++++++++++--------- protos/plugin/codegen.proto | 9 + 13 files changed, 555 insertions(+), 347 deletions(-) diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index fb160b170c..6c829edb4f 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -207,8 +207,10 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer } files := map[string]string{} - for _, file := range resp.Files { - files[file.Name] = string(file.Contents) + if resp != nil { + for _, file := range resp.Files { + files[file.Name] = string(file.Contents) + } } if err != nil { diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index e7f2fea697..4c056c2778 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -39,6 +39,7 @@ func pluginOverride(o config.Override) *plugin.Override { ColumnName: column, Table: &table, PythonType: pluginPythonType(o.PythonType), + GoType: pluginGoType(o), } } @@ -56,6 +57,7 @@ func pluginSettings(cs config.CombinedSettings) *plugin.Settings { Rename: cs.Rename, Python: pluginPythonCode(cs.Python), Kotlin: pluginKotlinCode(cs.Kotlin), + Go: pluginGoCode(cs.Go), } } @@ -69,6 +71,42 @@ func pluginPythonCode(s config.SQLPython) *plugin.PythonCode { } } +func pluginGoCode(s config.SQLGo) *plugin.GoCode { + return &plugin.GoCode{ + EmitInterface: s.EmitInterface, + EmitJsonTags: s.EmitJSONTags, + EmitDbTags: s.EmitDBTags, + EmitPreparedQueries: s.EmitPreparedQueries, + EmitExactTableNames: s.EmitExactTableNames, + EmitEmptySlices: s.EmitEmptySlices, + EmitExportedQueries: s.EmitExportedQueries, + EmitResultStructPointers: s.EmitResultStructPointers, + EmitParamsStructPointers: s.EmitParamsStructPointers, + EmitMethodsWithDbArgument: s.EmitMethodsWithDBArgument, + JsonTagsCaseStyle: s.JSONTagsCaseStyle, + Package: s.Package, + Out: s.Out, + SqlPackage: s.SQLPackage, + OutputDbFileName: s.OutputDBFileName, + OutputModelsFileName: s.OutputModelsFileName, + OutputQuerierFileName: s.OutputQuerierFileName, + OutputFilesSuffix: s.OutputFilesSuffix, + } +} + +func pluginGoType(o config.Override) *plugin.ParsedGoType { + // Note that there is a slight mismatch between this and the + // proto api. The GoType on the override is the unparsed type, + // which could be a qualified path or an object, as per + // https://docs.sqlc.dev/en/latest/reference/config.html#renaming-struct-fields + return &plugin.ParsedGoType{ + ImportPath: o.GoImportPath, + Package: o.GoPackage, + TypeName: o.GoTypeName, + BasicType: o.GoBasicType, + } +} + func pluginPythonType(pt config.PythonType) *plugin.PythonType { return &plugin.PythonType{ Module: pt.Module, diff --git a/internal/codegen/golang/driver.go b/internal/codegen/golang/driver.go index 03485aab83..b9efe77abf 100644 --- a/internal/codegen/golang/driver.go +++ b/internal/codegen/golang/driver.go @@ -12,7 +12,7 @@ const ( ) func parseDriver(settings *plugin.Settings) SQLDriver { - if settings.Go.SQLPackage == "pgx/v4" { + if settings.Go.SqlPackage == "pgx/v4" { return SQLDriverPGXV4 } else { return SQLDriverLibPQ diff --git a/internal/codegen/golang/field.go b/internal/codegen/golang/field.go index be2f9caa30..6b22c8798b 100644 --- a/internal/codegen/golang/field.go +++ b/internal/codegen/golang/field.go @@ -29,7 +29,7 @@ func (gf Field) Tag() string { } func JSONTagName(name string, settings *plugin.Settings) string { - style := settings.Go.JSONTagsCaseStyle + style := settings.Go.JsonTagsCaseStyle if style == "" || style == "none" { return name } else { diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index dcd54f05f2..f0320761a2 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -1,19 +1,61 @@ package golang import ( - "github.com/kyleconroy/sqlc/internal/compiler" + "github.com/kyleconroy/sqlc/internal/pattern" "github.com/kyleconroy/sqlc/internal/plugin" ) -func goType(req *plugin.CodeGenRequest, col *compiler.Column) string { +// XXX: dedupe +func matchString(pat, target string) bool { + matcher, err := pattern.MatchCompile(pat) + if err != nil { + panic(err) + } + return matcher.MatchString(target) +} + +func matches(o *plugin.Override, n *plugin.Identifier, defaultSchema string) bool { + if n == nil { + return false + } + + schema := n.Schema + if n.Schema == "" { + schema = defaultSchema + } + + if o.Table.Catalog != "" && !matchString(o.Table.Catalog, n.Catalog) { + return false + } + + if o.Table.Schema == "" && schema != "" { + return false + } + + if o.Table.Schema != "" && !matchString(o.Table.Schema, schema) { + return false + } + + if o.Table.Name == "" && n.Name != "" { + return false + } + + if o.Table.Name != "" && !matchString(o.Table.Name, n.Name) { + return false + } + + return true +} + +func goType(req *plugin.CodeGenRequest, col *plugin.Column) string { // Check if the column's type has been overridden for _, oride := range req.Settings.Overrides { - if oride.GoTypeName == "" { + if oride.GoType.TypeName == "" { continue } - sameTable := oride.Matches(col.Table, req.Catalog.DefaultSchema) - if oride.Column != "" && oride.ColumnName.MatchString(col.Name) && sameTable { - return oride.GoTypeName + sameTable := matches(oride, col.Table, req.Catalog.DefaultSchema) + if oride.Column != "" && matchString(oride.ColumnName, col.Name) && sameTable { + return oride.GoType.TypeName } } typ := goInnerType(req, col) @@ -23,17 +65,17 @@ func goType(req *plugin.CodeGenRequest, col *compiler.Column) string { return typ } -func goInnerType(req *plugin.CodeGenRequest, col *compiler.Column) string { - columnType := col.DataType +func goInnerType(req *plugin.CodeGenRequest, col *plugin.Column) string { + columnType := dataType(col.Type) notNull := col.NotNull || col.IsArray // package overrides have a higher precedence for _, oride := range req.Settings.Overrides { - if oride.GoTypeName == "" { + if oride.GoType.TypeName == "" { continue } - if oride.DBType != "" && oride.DBType == columnType && oride.Nullable != notNull { - return oride.GoTypeName + if oride.DbType != "" && oride.DbType == columnType && oride.Nullable != notNull { + return oride.GoType.TypeName } } @@ -41,7 +83,7 @@ func goInnerType(req *plugin.CodeGenRequest, col *compiler.Column) string { switch req.Settings.Engine { case "mysql": return mysqlType(req, col) - case "postgres": + case "postgresql": return postgresType(req, col) case "_lemon": return sqliteType(req, col) diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index e321dd0e55..9140b65c66 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -201,10 +201,10 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) overrideTypes := map[string]string{} for _, o := range settings.Overrides { - if o.GoBasicType || o.GoTypeName == "" { + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } - overrideTypes[o.GoTypeName] = o.GoImportPath + overrideTypes[o.GoType.TypeName] = o.GoType.ImportPath } _, overrideNullTime := overrideTypes["pq.NullTime"] @@ -222,13 +222,13 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) // Custom imports for _, o := range settings.Overrides { - if o.GoBasicType || o.GoTypeName == "" { + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } - _, alreadyImported := std[o.GoImportPath] - hasPackageAlias := o.GoPackage != "" - if (!alreadyImported || hasPackageAlias) && uses(o.GoTypeName) { - pkg[ImportSpec{Path: o.GoImportPath, ID: o.GoPackage}] = struct{}{} + _, alreadyImported := std[o.GoType.ImportPath] // XXX + hasPackageAlias := o.GoType.Package != "" + if (!alreadyImported || hasPackageAlias) && uses(o.GoType.TypeName) { + pkg[ImportSpec{Path: o.GoType.ImportPath, ID: o.GoType.Package}] = struct{}{} } } diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index 8221a6f273..0d10edd6ed 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -3,13 +3,20 @@ package golang import ( "log" - "github.com/kyleconroy/sqlc/internal/compiler" "github.com/kyleconroy/sqlc/internal/debug" "github.com/kyleconroy/sqlc/internal/plugin" ) -func mysqlType(req *plugin.CodeGenRequest, col *compiler.Column) string { - columnType := col.DataType +func dataType(n *plugin.Identifier) string { + if n.Schema != "" { + return n.Schema + "." + n.Name + } else { + return n.Name + } +} + +func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { + columnType := dataType(col.Type) notNull := col.NotNull || col.IsArray switch columnType { @@ -21,7 +28,8 @@ func mysqlType(req *plugin.CodeGenRequest, col *compiler.Column) string { return "sql.NullString" case "tinyint": - if col.Length != nil && *col.Length == 1 { + // XXX: is this still right? + if col.Length == 1 { if notNull { return "bool" } diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index 5c9fada528..8e2cf3a253 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -6,11 +6,10 @@ import ( "github.com/kyleconroy/sqlc/internal/compiler" "github.com/kyleconroy/sqlc/internal/debug" "github.com/kyleconroy/sqlc/internal/plugin" - "github.com/kyleconroy/sqlc/internal/sql/catalog" ) -func postgresType(req *plugin.CodeGenRequest, col *compiler.Column) string { - columnType := col.DataType +func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { + columnType := dataType(col.Type) notNull := col.NotNull || col.IsArray driver := parseDriver(req.Settings) @@ -253,22 +252,21 @@ func postgresType(req *plugin.CodeGenRequest, col *compiler.Column) string { if schema.Name == "pg_catalog" { continue } - for _, typ := range schema.Types { - switch t := typ.(type) { - case *catalog.Enum: - if rel.Name == t.Name && rel.Schema == schema.Name { - if schema.Name == r.Catalog.DefaultSchema { - return StructName(t.Name, settings) - } - return StructName(schema.Name+"_"+t.Name, settings) - } - case *catalog.CompositeType: - // ???????? - if notNull { - return "string" + + for _, enum := range schema.Enums { + if rel.Name == enum.Name && rel.Schema == schema.Name { + if schema.Name == req.Catalog.DefaultSchema { + return StructName(enum.Name, req.Settings) } - return "sql.NullString" + return StructName(schema.Name+"_"+enum.Name, req.Settings) } + // case *catalog.CompositeType: + // XXX: ???????? Why is there something non-enum? + // if notNull { + // return "string" + // } + // return "sql.NullString" + // } } } if debug.Active { diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index 2eed835c6f..7218529e76 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -2,8 +2,10 @@ package golang import ( "fmt" + "log" "strings" + "github.com/davecgh/go-spew/spew" "github.com/kyleconroy/sqlc/internal/metadata" "github.com/kyleconroy/sqlc/internal/plugin" ) @@ -76,11 +78,13 @@ func (v QueryValue) UniqueFields() []Field { seen := map[string]struct{}{} fields := make([]Field, 0, len(v.Struct.Fields)) + log.Println("uniqes") for _, field := range v.Struct.Fields { if _, found := seen[field.Name]; found { continue } seen[field.Name] = struct{}{} + log.Println("what is unique?", spew.Sdump(field)) fields = append(fields, field) } diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index a419676216..86907b6250 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -2,11 +2,12 @@ package golang import ( "fmt" + "log" "sort" "strings" + "github.com/davecgh/go-spew/spew" "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/compiler" "github.com/kyleconroy/sqlc/internal/core" "github.com/kyleconroy/sqlc/internal/inflection" "github.com/kyleconroy/sqlc/internal/plugin" @@ -99,10 +100,10 @@ func buildStructs(req *plugin.CodeGenRequest) []Struct { type goColumn struct { id int - *compiler.Column + *plugin.Column } -func columnName(c *compiler.Column, pos int) string { +func columnName(c *plugin.Column, pos int) string { if c.Name != "" { return c.Name } @@ -158,6 +159,7 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Table: query.InsertIntoTable, } sqlpkg := SQLPackageFromString(req.Settings.Go.SqlPackage) + log.Println(query.Params) if len(query.Params) == 1 { p := query.Params[0] @@ -174,10 +176,12 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Column: p.Column, }) } + log.Println("cols", spew.Sdump(cols)) s, err := columnsToStruct(req, gq.MethodName+"Params", cols, false) if err != nil { return nil, err } + log.Println("to struct", spew.Sdump(s)) gq.Arg = QueryValue{ Emit: true, Name: "arg", diff --git a/internal/codegen/golang/sqlite_type.go b/internal/codegen/golang/sqlite_type.go index 887928f104..1a3f8e3465 100644 --- a/internal/codegen/golang/sqlite_type.go +++ b/internal/codegen/golang/sqlite_type.go @@ -4,12 +4,11 @@ import ( "log" "strings" - "github.com/kyleconroy/sqlc/internal/compiler" "github.com/kyleconroy/sqlc/internal/plugin" ) -func sqliteType(req *plugin.CodeGenRequest, col *compiler.Column) string { - dt := strings.ToLower(col.DataType) +func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { + dt := strings.ToLower(dataType(col.Type)) notNull := col.NotNull || col.IsArray switch dt { diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index e23c651ca9..8cdaa7dbd8 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -87,10 +87,11 @@ type Override struct { // True if the override should apply to a nullable database type Nullable bool `protobuf:"varint,5,opt,name=nullable,proto3" json:"nullable,omitempty"` // fully qualified name of the column, e.g. `accounts.id` - Column string `protobuf:"bytes,6,opt,name=column,proto3" json:"column,omitempty"` - Table *Identifier `protobuf:"bytes,7,opt,name=table,proto3" json:"table,omitempty"` - ColumnName string `protobuf:"bytes,8,opt,name=column_name,proto3" json:"column_name,omitempty"` - PythonType *PythonType `protobuf:"bytes,9,opt,name=python_type,json=pythonType,proto3" json:"python_type,omitempty"` + Column string `protobuf:"bytes,6,opt,name=column,proto3" json:"column,omitempty"` + Table *Identifier `protobuf:"bytes,7,opt,name=table,proto3" json:"table,omitempty"` + ColumnName string `protobuf:"bytes,8,opt,name=column_name,proto3" json:"column_name,omitempty"` + PythonType *PythonType `protobuf:"bytes,9,opt,name=python_type,json=pythonType,proto3" json:"python_type,omitempty"` + GoType *ParsedGoType `protobuf:"bytes,10,opt,name=go_type,json=goType,proto3" json:"go_type,omitempty"` } func (x *Override) Reset() { @@ -174,6 +175,13 @@ func (x *Override) GetPythonType() *PythonType { return nil } +func (x *Override) GetGoType() *ParsedGoType { + if x != nil { + return x.GoType + } + return nil +} + type PythonType struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -229,6 +237,77 @@ func (x *PythonType) GetName() string { return "" } +type ParsedGoType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ImportPath string `protobuf:"bytes,1,opt,name=import_path,json=importPath,proto3" json:"import_path,omitempty"` + Package string `protobuf:"bytes,2,opt,name=package,proto3" json:"package,omitempty"` + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + BasicType bool `protobuf:"varint,4,opt,name=basic_type,json=basicType,proto3" json:"basic_type,omitempty"` +} + +func (x *ParsedGoType) Reset() { + *x = ParsedGoType{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ParsedGoType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParsedGoType) ProtoMessage() {} + +func (x *ParsedGoType) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[3] + 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 ParsedGoType.ProtoReflect.Descriptor instead. +func (*ParsedGoType) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{3} +} + +func (x *ParsedGoType) GetImportPath() string { + if x != nil { + return x.ImportPath + } + return "" +} + +func (x *ParsedGoType) GetPackage() string { + if x != nil { + return x.Package + } + return "" +} + +func (x *ParsedGoType) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *ParsedGoType) GetBasicType() bool { + if x != nil { + return x.BasicType + } + return false +} + type Settings struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -249,7 +328,7 @@ type Settings struct { func (x *Settings) Reset() { *x = Settings{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[3] + mi := &file_plugin_codegen_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +341,7 @@ func (x *Settings) String() string { func (*Settings) ProtoMessage() {} func (x *Settings) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[3] + mi := &file_plugin_codegen_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +354,7 @@ func (x *Settings) ProtoReflect() protoreflect.Message { // Deprecated: Use Settings.ProtoReflect.Descriptor instead. func (*Settings) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{3} + return file_plugin_codegen_proto_rawDescGZIP(), []int{4} } func (x *Settings) GetVersion() string { @@ -356,7 +435,7 @@ type PythonCode struct { func (x *PythonCode) Reset() { *x = PythonCode{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[4] + mi := &file_plugin_codegen_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -369,7 +448,7 @@ func (x *PythonCode) String() string { func (*PythonCode) ProtoMessage() {} func (x *PythonCode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[4] + mi := &file_plugin_codegen_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -382,7 +461,7 @@ func (x *PythonCode) ProtoReflect() protoreflect.Message { // Deprecated: Use PythonCode.ProtoReflect.Descriptor instead. func (*PythonCode) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4} + return file_plugin_codegen_proto_rawDescGZIP(), []int{5} } func (x *PythonCode) GetEmitExactTableNames() bool { @@ -433,7 +512,7 @@ type KotlinCode struct { func (x *KotlinCode) Reset() { *x = KotlinCode{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -446,7 +525,7 @@ func (x *KotlinCode) String() string { func (*KotlinCode) ProtoMessage() {} func (x *KotlinCode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -459,7 +538,7 @@ func (x *KotlinCode) ProtoReflect() protoreflect.Message { // Deprecated: Use KotlinCode.ProtoReflect.Descriptor instead. func (*KotlinCode) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{5} + return file_plugin_codegen_proto_rawDescGZIP(), []int{6} } func (x *KotlinCode) GetEmitExactTableNames() bool { @@ -512,7 +591,7 @@ type GoCode struct { func (x *GoCode) Reset() { *x = GoCode{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -525,7 +604,7 @@ func (x *GoCode) String() string { func (*GoCode) ProtoMessage() {} func (x *GoCode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -538,7 +617,7 @@ func (x *GoCode) ProtoReflect() protoreflect.Message { // Deprecated: Use GoCode.ProtoReflect.Descriptor instead. func (*GoCode) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{6} + return file_plugin_codegen_proto_rawDescGZIP(), []int{7} } func (x *GoCode) GetEmitInterface() bool { @@ -681,7 +760,7 @@ type Catalog struct { func (x *Catalog) Reset() { *x = Catalog{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -694,7 +773,7 @@ func (x *Catalog) String() string { func (*Catalog) ProtoMessage() {} func (x *Catalog) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -707,7 +786,7 @@ func (x *Catalog) ProtoReflect() protoreflect.Message { // Deprecated: Use Catalog.ProtoReflect.Descriptor instead. func (*Catalog) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{7} + return file_plugin_codegen_proto_rawDescGZIP(), []int{8} } func (x *Catalog) GetComment() string { @@ -752,7 +831,7 @@ type Schema struct { func (x *Schema) Reset() { *x = Schema{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -765,7 +844,7 @@ func (x *Schema) String() string { func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[8] + mi := &file_plugin_codegen_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -778,7 +857,7 @@ func (x *Schema) ProtoReflect() protoreflect.Message { // Deprecated: Use Schema.ProtoReflect.Descriptor instead. func (*Schema) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{8} + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} } func (x *Schema) GetComment() string { @@ -822,7 +901,7 @@ type Enum struct { func (x *Enum) Reset() { *x = Enum{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -835,7 +914,7 @@ func (x *Enum) String() string { func (*Enum) ProtoMessage() {} func (x *Enum) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[9] + mi := &file_plugin_codegen_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -848,7 +927,7 @@ func (x *Enum) ProtoReflect() protoreflect.Message { // Deprecated: Use Enum.ProtoReflect.Descriptor instead. func (*Enum) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{9} + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} } func (x *Enum) GetName() string { @@ -885,7 +964,7 @@ type Table struct { func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -898,7 +977,7 @@ func (x *Table) String() string { func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -911,7 +990,7 @@ func (x *Table) ProtoReflect() protoreflect.Message { // Deprecated: Use Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{10} + return file_plugin_codegen_proto_rawDescGZIP(), []int{11} } func (x *Table) GetRel() *Identifier { @@ -948,7 +1027,7 @@ type Identifier struct { func (x *Identifier) Reset() { *x = Identifier{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -961,7 +1040,7 @@ func (x *Identifier) String() string { func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -974,7 +1053,7 @@ func (x *Identifier) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier.ProtoReflect.Descriptor instead. func (*Identifier) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{11} + return file_plugin_codegen_proto_rawDescGZIP(), []int{12} } func (x *Identifier) GetCatalog() string { @@ -1021,7 +1100,7 @@ type Column struct { func (x *Column) Reset() { *x = Column{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1034,7 +1113,7 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1047,7 +1126,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{12} + return file_plugin_codegen_proto_rawDescGZIP(), []int{13} } func (x *Column) GetName() string { @@ -1152,7 +1231,7 @@ type Query struct { func (x *Query) Reset() { *x = Query{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1165,7 +1244,7 @@ func (x *Query) String() string { func (*Query) ProtoMessage() {} func (x *Query) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1178,7 +1257,7 @@ func (x *Query) ProtoReflect() protoreflect.Message { // Deprecated: Use Query.ProtoReflect.Descriptor instead. func (*Query) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{13} + return file_plugin_codegen_proto_rawDescGZIP(), []int{14} } func (x *Query) GetText() string { @@ -1249,7 +1328,7 @@ type Parameter struct { func (x *Parameter) Reset() { *x = Parameter{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1262,7 +1341,7 @@ func (x *Parameter) String() string { func (*Parameter) ProtoMessage() {} func (x *Parameter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1275,7 +1354,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{14} + return file_plugin_codegen_proto_rawDescGZIP(), []int{15} } func (x *Parameter) GetNumber() int32 { @@ -1305,7 +1384,7 @@ type CodeGenRequest struct { func (x *CodeGenRequest) Reset() { *x = CodeGenRequest{} 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) } @@ -1318,7 +1397,7 @@ func (x *CodeGenRequest) String() string { func (*CodeGenRequest) ProtoMessage() {} func (x *CodeGenRequest) 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 { @@ -1331,7 +1410,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{15} + return file_plugin_codegen_proto_rawDescGZIP(), []int{16} } func (x *CodeGenRequest) GetSettings() *Settings { @@ -1366,7 +1445,7 @@ type CodeGenResponse struct { func (x *CodeGenResponse) Reset() { *x = CodeGenResponse{} 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) } @@ -1379,7 +1458,7 @@ func (x *CodeGenResponse) String() string { func (*CodeGenResponse) ProtoMessage() {} func (x *CodeGenResponse) 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 { @@ -1392,7 +1471,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{16} + return file_plugin_codegen_proto_rawDescGZIP(), []int{17} } func (x *CodeGenResponse) GetFiles() []*File { @@ -1410,7 +1489,7 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xf7, 0x01, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x72, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xa6, 0x02, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, @@ -1426,203 +1505,214 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x22, 0x38, 0x0a, 0x0a, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x87, 0x03, 0x0a, 0x08, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 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, 0x12, 0x34, 0x0a, 0x06, 0x72, - 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x52, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4f, 0x76, - 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x79, 0x74, 0x68, 0x6f, - 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, - 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x64, - 0x65, 0x52, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x02, 0x67, 0x6f, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, - 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x02, 0x67, 0x6f, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x6e, - 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc7, 0x01, 0x0a, 0x0a, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x43, + 0x12, 0x2d, 0x0a, 0x07, 0x67, 0x6f, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, + 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x67, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x22, + 0x38, 0x0a, 0x0a, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, + 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x0c, 0x50, 0x61, + 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6d, + 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x70, + 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x79, 0x70, 0x65, 0x4e, 0x61, + 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x54, 0x79, 0x70, + 0x65, 0x22, 0x87, 0x03, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 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, 0x12, 0x34, 0x0a, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x74, 0x74, + 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x06, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, + 0x72, 0x69, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x52, 0x09, 0x6f, + 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x70, 0x79, 0x74, 0x68, + 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x70, 0x79, + 0x74, 0x68, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x4b, 0x6f, + 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x06, 0x6b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, + 0x12, 0x1e, 0x0a, 0x02, 0x67, 0x6f, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x02, 0x67, 0x6f, + 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc7, 0x01, 0x0a, 0x0a, + 0x50, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6d, + 0x69, 0x74, 0x5f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, + 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, + 0x2a, 0x0a, 0x11, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x71, 0x75, 0x65, + 0x72, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6d, 0x69, 0x74, + 0x53, 0x79, 0x6e, 0x63, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x65, + 0x6d, 0x69, 0x74, 0x5f, 0x61, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x65, 0x6d, 0x69, 0x74, 0x41, 0x73, 0x79, + 0x6e, 0x63, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, + 0x6b, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6f, 0x75, 0x74, 0x22, 0x6d, 0x0a, 0x0a, 0x4b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, - 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6d, 0x69, 0x74, - 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6d, 0x69, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x75, 0x65, - 0x72, 0x69, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x61, 0x73, 0x79, - 0x6e, 0x63, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x10, 0x65, 0x6d, 0x69, 0x74, 0x41, 0x73, 0x79, 0x6e, 0x63, 0x51, 0x75, 0x65, 0x72, 0x69, - 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, - 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x22, 0x6d, - 0x0a, 0x0a, 0x4b, 0x6f, 0x74, 0x6c, 0x69, 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x16, - 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, - 0x69, 0x74, 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, - 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x22, 0xcd, 0x06, - 0x0a, 0x06, 0x47, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, - 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0d, 0x65, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, - 0x24, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6d, 0x69, 0x74, 0x4a, 0x73, 0x6f, - 0x6e, 0x54, 0x61, 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0c, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x64, 0x62, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x65, 0x6d, 0x69, - 0x74, 0x44, 0x62, 0x54, 0x61, 0x67, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6d, 0x69, 0x74, 0x5f, - 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x72, 0x65, 0x70, - 0x61, 0x72, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x65, - 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, - 0x74, 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x73, - 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6d, 0x69, - 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, - 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x71, 0x75, - 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, - 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, - 0x12, 0x3d, 0x0a, 0x1b, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x3d, 0x0a, 0x1b, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x73, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, 0x69, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x40, - 0x0a, 0x1d, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x5f, 0x77, - 0x69, 0x74, 0x68, 0x5f, 0x64, 0x62, 0x5f, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x65, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x73, 0x57, 0x69, 0x74, 0x68, 0x44, 0x62, 0x41, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x2f, 0x0a, 0x14, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x5f, 0x63, 0x61, - 0x73, 0x65, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x6a, 0x73, 0x6f, 0x6e, 0x54, 0x61, 0x67, 0x73, 0x43, 0x61, 0x73, 0x65, 0x53, 0x74, 0x79, 0x6c, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, - 0x75, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, - 0x0b, 0x73, 0x71, 0x6c, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x73, 0x71, 0x6c, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x2d, - 0x0a, 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x64, 0x62, 0x5f, 0x66, 0x69, 0x6c, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x44, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, - 0x17, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x5f, 0x66, - 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x71, - 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x51, 0x75, - 0x65, 0x72, 0x69, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, - 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x73, 0x75, - 0x66, 0x66, 0x69, 0x78, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x53, 0x75, 0x66, 0x66, 0x69, 0x78, 0x22, 0x88, 0x01, - 0x0a, 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, - 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, - 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, 0x81, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, - 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x22, 0x48, 0x0a, 0x04, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, - 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, - 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 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, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, - 0x18, 0x02, 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, - 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, - 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xf2, 0x02, - 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, - 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, - 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, - 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, - 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, - 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, - 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 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, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, - 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 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, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x22, 0x90, 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, 0x3c, 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, - 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, - 0x54, 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, 0x92, 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, 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, 0x42, 0x2c, - 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, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6f, 0x75, 0x74, 0x22, 0xcd, 0x06, 0x0a, 0x06, 0x47, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x25, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x6a, + 0x73, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, + 0x65, 0x6d, 0x69, 0x74, 0x4a, 0x73, 0x6f, 0x6e, 0x54, 0x61, 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0c, + 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x64, 0x62, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x65, 0x6d, 0x69, 0x74, 0x44, 0x62, 0x54, 0x61, 0x67, 0x73, 0x12, 0x32, + 0x0a, 0x15, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x5f, + 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x65, + 0x6d, 0x69, 0x74, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x51, 0x75, 0x65, 0x72, 0x69, + 0x65, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x61, 0x63, 0x74, + 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x78, 0x61, 0x63, 0x74, 0x54, 0x61, 0x62, + 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x65, 0x6d, 0x69, 0x74, 0x5f, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0f, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x53, 0x6c, 0x69, + 0x63, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x64, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x13, 0x65, 0x6d, 0x69, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, + 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x65, 0x6d, 0x69, 0x74, 0x5f, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, + 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x6f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6d, 0x69, + 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x50, 0x6f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x40, 0x0a, 0x1d, 0x65, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x64, 0x62, 0x5f, 0x61, 0x72, + 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x19, 0x65, 0x6d, + 0x69, 0x74, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x57, 0x69, 0x74, 0x68, 0x44, 0x62, 0x41, + 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x5f, 0x63, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6a, 0x73, 0x6f, 0x6e, 0x54, 0x61, 0x67, 0x73, 0x43, + 0x61, 0x73, 0x65, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b, 0x61, + 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x75, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x71, 0x6c, 0x5f, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x71, 0x6c, 0x50, 0x61, + 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x2d, 0x0a, 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, + 0x64, 0x62, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x10, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x44, 0x62, 0x46, 0x69, 0x6c, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x18, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x5f, 0x66, 0x69, + 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x13, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x66, + 0x69, 0x6c, 0x65, 0x73, 0x5f, 0x73, 0x75, 0x66, 0x66, 0x69, 0x78, 0x18, 0x12, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x11, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x53, 0x75, + 0x66, 0x66, 0x69, 0x78, 0x22, 0x88, 0x01, 0x0a, 0x07, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, + 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, + 0x81, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, + 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, + 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, + 0x75, 0x6d, 0x73, 0x22, 0x48, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, + 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, + 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 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, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, 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, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, + 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xf2, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, + 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, + 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, + 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, + 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x0a, 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, 0x05, 0x74, 0x61, + 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, + 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, + 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 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, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x90, 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, 0x3c, + 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x0f, 0x49, 0x6e, 0x73, + 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x92, 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, 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, 0x42, 0x2c, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1637,55 +1727,57 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 18) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_plugin_codegen_proto_goTypes = []interface{}{ (*File)(nil), // 0: plugin.File (*Override)(nil), // 1: plugin.Override (*PythonType)(nil), // 2: plugin.PythonType - (*Settings)(nil), // 3: plugin.Settings - (*PythonCode)(nil), // 4: plugin.PythonCode - (*KotlinCode)(nil), // 5: plugin.KotlinCode - (*GoCode)(nil), // 6: plugin.GoCode - (*Catalog)(nil), // 7: plugin.Catalog - (*Schema)(nil), // 8: plugin.Schema - (*Enum)(nil), // 9: plugin.Enum - (*Table)(nil), // 10: plugin.Table - (*Identifier)(nil), // 11: plugin.Identifier - (*Column)(nil), // 12: plugin.Column - (*Query)(nil), // 13: plugin.Query - (*Parameter)(nil), // 14: plugin.Parameter - (*CodeGenRequest)(nil), // 15: plugin.CodeGenRequest - (*CodeGenResponse)(nil), // 16: plugin.CodeGenResponse - nil, // 17: plugin.Settings.RenameEntry + (*ParsedGoType)(nil), // 3: plugin.ParsedGoType + (*Settings)(nil), // 4: plugin.Settings + (*PythonCode)(nil), // 5: plugin.PythonCode + (*KotlinCode)(nil), // 6: plugin.KotlinCode + (*GoCode)(nil), // 7: plugin.GoCode + (*Catalog)(nil), // 8: plugin.Catalog + (*Schema)(nil), // 9: plugin.Schema + (*Enum)(nil), // 10: plugin.Enum + (*Table)(nil), // 11: plugin.Table + (*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 + nil, // 18: plugin.Settings.RenameEntry } var file_plugin_codegen_proto_depIdxs = []int32{ - 11, // 0: plugin.Override.table:type_name -> plugin.Identifier + 12, // 0: plugin.Override.table:type_name -> plugin.Identifier 2, // 1: plugin.Override.python_type:type_name -> plugin.PythonType - 17, // 2: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry - 1, // 3: plugin.Settings.overrides:type_name -> plugin.Override - 4, // 4: plugin.Settings.python:type_name -> plugin.PythonCode - 5, // 5: plugin.Settings.kotlin:type_name -> plugin.KotlinCode - 6, // 6: plugin.Settings.go:type_name -> plugin.GoCode - 8, // 7: plugin.Catalog.schemas:type_name -> plugin.Schema - 10, // 8: plugin.Schema.tables:type_name -> plugin.Table - 9, // 9: plugin.Schema.enums:type_name -> plugin.Enum - 11, // 10: plugin.Table.rel:type_name -> plugin.Identifier - 12, // 11: plugin.Table.columns:type_name -> plugin.Column - 11, // 12: plugin.Column.table:type_name -> plugin.Identifier - 11, // 13: plugin.Column.type:type_name -> plugin.Identifier - 12, // 14: plugin.Query.columns:type_name -> plugin.Column - 14, // 15: plugin.Query.params:type_name -> plugin.Parameter - 11, // 16: plugin.Query.InsertIntoTable:type_name -> plugin.Identifier - 12, // 17: plugin.Parameter.column:type_name -> plugin.Column - 3, // 18: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 7, // 19: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 13, // 20: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 21: plugin.CodeGenResponse.files:type_name -> plugin.File - 22, // [22:22] is the sub-list for method output_type - 22, // [22:22] is the sub-list for method input_type - 22, // [22:22] is the sub-list for extension type_name - 22, // [22:22] is the sub-list for extension extendee - 0, // [0:22] is the sub-list for field type_name + 3, // 2: plugin.Override.go_type:type_name -> plugin.ParsedGoType + 18, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry + 1, // 4: plugin.Settings.overrides:type_name -> plugin.Override + 5, // 5: plugin.Settings.python:type_name -> plugin.PythonCode + 6, // 6: plugin.Settings.kotlin:type_name -> plugin.KotlinCode + 7, // 7: plugin.Settings.go:type_name -> plugin.GoCode + 9, // 8: plugin.Catalog.schemas:type_name -> plugin.Schema + 11, // 9: plugin.Schema.tables:type_name -> plugin.Table + 10, // 10: plugin.Schema.enums:type_name -> plugin.Enum + 12, // 11: plugin.Table.rel:type_name -> plugin.Identifier + 13, // 12: plugin.Table.columns:type_name -> plugin.Column + 12, // 13: plugin.Column.table:type_name -> plugin.Identifier + 12, // 14: plugin.Column.type:type_name -> plugin.Identifier + 13, // 15: plugin.Query.columns:type_name -> plugin.Column + 15, // 16: plugin.Query.params:type_name -> plugin.Parameter + 12, // 17: plugin.Query.InsertIntoTable:type_name -> plugin.Identifier + 13, // 18: plugin.Parameter.column:type_name -> plugin.Column + 4, // 19: plugin.CodeGenRequest.settings:type_name -> plugin.Settings + 8, // 20: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog + 14, // 21: plugin.CodeGenRequest.queries:type_name -> plugin.Query + 0, // 22: plugin.CodeGenResponse.files:type_name -> plugin.File + 23, // [23:23] is the sub-list for method output_type + 23, // [23:23] is the sub-list for method input_type + 23, // [23:23] is the sub-list for extension type_name + 23, // [23:23] is the sub-list for extension extendee + 0, // [0:23] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -1731,7 +1823,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Settings); i { + switch v := v.(*ParsedGoType); i { case 0: return &v.state case 1: @@ -1743,7 +1835,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PythonCode); i { + switch v := v.(*Settings); i { case 0: return &v.state case 1: @@ -1755,7 +1847,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KotlinCode); i { + switch v := v.(*PythonCode); i { case 0: return &v.state case 1: @@ -1767,7 +1859,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GoCode); i { + switch v := v.(*KotlinCode); i { case 0: return &v.state case 1: @@ -1779,7 +1871,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Catalog); i { + switch v := v.(*GoCode); i { case 0: return &v.state case 1: @@ -1791,7 +1883,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Schema); i { + switch v := v.(*Catalog); i { case 0: return &v.state case 1: @@ -1803,7 +1895,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Enum); i { + switch v := v.(*Schema); i { case 0: return &v.state case 1: @@ -1815,7 +1907,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { + switch v := v.(*Enum); i { case 0: return &v.state case 1: @@ -1827,7 +1919,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { + switch v := v.(*Table); i { case 0: return &v.state case 1: @@ -1839,7 +1931,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { + switch v := v.(*Identifier); i { case 0: return &v.state case 1: @@ -1851,7 +1943,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { + switch v := v.(*Column); i { case 0: return &v.state case 1: @@ -1863,7 +1955,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Parameter); i { + switch v := v.(*Query); i { case 0: return &v.state case 1: @@ -1875,7 +1967,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenRequest); i { + switch v := v.(*Parameter); i { case 0: return &v.state case 1: @@ -1887,6 +1979,18 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeGenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CodeGenResponse); i { case 0: return &v.state @@ -1905,7 +2009,7 @@ func file_plugin_codegen_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 18, + NumMessages: 19, NumExtensions: 0, NumServices: 0, }, diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index b85354e694..ea2f1a4abf 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -28,6 +28,8 @@ message Override { string column_name = 8 [json_name="column_name"]; PythonType python_type = 9; + + ParsedGoType go_type = 10; } message PythonType @@ -36,6 +38,13 @@ message PythonType string name = 2; } +message ParsedGoType +{ + string import_path = 1; + string package = 2; + string type_name = 3; + bool basic_type = 4; +} message Settings { From 286eb40bc115a518e55332ef6f00fda18d5acfcd Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Mon, 28 Feb 2022 21:11:09 -0600 Subject: [PATCH 3/7] last bit --- internal/cmd/shim.go | 65 ++-- internal/codegen/golang/postgresql_type.go | 17 +- internal/codegen/golang/query.go | 4 - internal/codegen/golang/result.go | 5 - internal/plugin/codegen.pb.go | 377 +++++++++++++-------- protos/plugin/codegen.proto | 7 + 6 files changed, 289 insertions(+), 186 deletions(-) diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 4c056c2778..e879b33c80 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -126,16 +126,21 @@ func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { var schemas []*plugin.Schema for _, s := range c.Schemas { var enums []*plugin.Enum + var cts []*plugin.CompositeType for _, typ := range s.Types { - enum, ok := typ.(*catalog.Enum) - if !ok { - continue + switch typ := typ.(type) { + case *catalog.Enum: + enums = append(enums, &plugin.Enum{ + Name: typ.Name, + Comment: typ.Comment, + Vals: typ.Vals, + }) + case *catalog.CompositeType: + cts = append(cts, &plugin.CompositeType{ + Name: typ.Name, + Comment: typ.Comment, + }) } - enums = append(enums, &plugin.Enum{ - Name: enum.Name, - Comment: enum.Comment, - Vals: enum.Vals, - }) } var tables []*plugin.Table for _, t := range s.Tables { @@ -174,10 +179,11 @@ func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { }) } schemas = append(schemas, &plugin.Schema{ - Comment: s.Comment, - Name: s.Name, - Tables: tables, - Enums: enums, + Comment: s.Comment, + Name: s.Name, + Tables: tables, + Enums: enums, + CompositeTypes: cts, }) } return &plugin.Catalog{ @@ -199,14 +205,23 @@ func pluginQueries(r *compiler.Result) []*plugin.Query { for _, p := range q.Params { params = append(params, pluginQueryParam(p)) } + var iit *plugin.Identifier + if q.InsertIntoTable != nil { + iit = &plugin.Identifier{ + Catalog: q.InsertIntoTable.Catalog, + Schema: q.InsertIntoTable.Schema, + Name: q.InsertIntoTable.Name, + } + } out = append(out, &plugin.Query{ - Name: q.Name, - Cmd: q.Cmd, - Text: q.SQL, - Comments: q.Comments, - Columns: columns, - Params: params, - Filename: q.Filename, + Name: q.Name, + Cmd: q.Cmd, + Text: q.SQL, + Comments: q.Comments, + Columns: columns, + Params: params, + Filename: q.Filename, + InsertIntoTable: iit, }) } return out @@ -218,11 +233,13 @@ func pluginQueryColumn(c *compiler.Column) *plugin.Column { l = *c.Length } out := &plugin.Column{ - Name: c.Name, - Comment: c.Comment, - NotNull: c.NotNull, - IsArray: c.IsArray, - Length: int32(l), + Name: c.Name, + Comment: c.Comment, + NotNull: c.NotNull, + IsArray: c.IsArray, + Length: int32(l), + IsNamedParam: c.IsNamedParam, + IsFuncCall: c.IsFuncCall, } if c.Type != nil { diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index 8e2cf3a253..e73a73cd72 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -260,13 +260,16 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { } return StructName(schema.Name+"_"+enum.Name, req.Settings) } - // case *catalog.CompositeType: - // XXX: ???????? Why is there something non-enum? - // if notNull { - // return "string" - // } - // return "sql.NullString" - // } + } + + for _, ct := range schema.CompositeTypes { + // XXX: old code had a bug? + if rel.Name == ct.Name && rel.Schema == schema.Name { + if notNull { + return "string" + } + return "sql.NullString" + } } } if debug.Active { diff --git a/internal/codegen/golang/query.go b/internal/codegen/golang/query.go index 7218529e76..2eed835c6f 100644 --- a/internal/codegen/golang/query.go +++ b/internal/codegen/golang/query.go @@ -2,10 +2,8 @@ package golang import ( "fmt" - "log" "strings" - "github.com/davecgh/go-spew/spew" "github.com/kyleconroy/sqlc/internal/metadata" "github.com/kyleconroy/sqlc/internal/plugin" ) @@ -78,13 +76,11 @@ func (v QueryValue) UniqueFields() []Field { seen := map[string]struct{}{} fields := make([]Field, 0, len(v.Struct.Fields)) - log.Println("uniqes") for _, field := range v.Struct.Fields { if _, found := seen[field.Name]; found { continue } seen[field.Name] = struct{}{} - log.Println("what is unique?", spew.Sdump(field)) fields = append(fields, field) } diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 86907b6250..99ba260bf8 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -2,11 +2,9 @@ package golang import ( "fmt" - "log" "sort" "strings" - "github.com/davecgh/go-spew/spew" "github.com/kyleconroy/sqlc/internal/codegen" "github.com/kyleconroy/sqlc/internal/core" "github.com/kyleconroy/sqlc/internal/inflection" @@ -159,7 +157,6 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Table: query.InsertIntoTable, } sqlpkg := SQLPackageFromString(req.Settings.Go.SqlPackage) - log.Println(query.Params) if len(query.Params) == 1 { p := query.Params[0] @@ -176,12 +173,10 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) Column: p.Column, }) } - log.Println("cols", spew.Sdump(cols)) s, err := columnsToStruct(req, gq.MethodName+"Params", cols, false) if err != nil { return nil, err } - log.Println("to struct", spew.Sdump(s)) gq.Arg = QueryValue{ Emit: true, Name: "arg", diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 8cdaa7dbd8..5b69e0f68a 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -822,10 +822,11 @@ type Schema struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Tables []*Table `protobuf:"bytes,3,rep,name=tables,proto3" json:"tables,omitempty"` - Enums []*Enum `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` + Comment string `protobuf:"bytes,1,opt,name=comment,proto3" json:"comment,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Tables []*Table `protobuf:"bytes,3,rep,name=tables,proto3" json:"tables,omitempty"` + Enums []*Enum `protobuf:"bytes,4,rep,name=enums,proto3" json:"enums,omitempty"` + CompositeTypes []*CompositeType `protobuf:"bytes,5,rep,name=composite_types,json=compositeTypes,proto3" json:"composite_types,omitempty"` } func (x *Schema) Reset() { @@ -888,6 +889,68 @@ func (x *Schema) GetEnums() []*Enum { return nil } +func (x *Schema) GetCompositeTypes() []*CompositeType { + if x != nil { + return x.CompositeTypes + } + return nil +} + +type CompositeType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Comment string `protobuf:"bytes,2,opt,name=comment,proto3" json:"comment,omitempty"` +} + +func (x *CompositeType) Reset() { + *x = CompositeType{} + if protoimpl.UnsafeEnabled { + mi := &file_plugin_codegen_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CompositeType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompositeType) ProtoMessage() {} + +func (x *CompositeType) ProtoReflect() protoreflect.Message { + mi := &file_plugin_codegen_proto_msgTypes[10] + 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 CompositeType.ProtoReflect.Descriptor instead. +func (*CompositeType) Descriptor() ([]byte, []int) { + return file_plugin_codegen_proto_rawDescGZIP(), []int{10} +} + +func (x *CompositeType) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CompositeType) GetComment() string { + if x != nil { + return x.Comment + } + return "" +} + type Enum struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -901,7 +964,7 @@ type Enum struct { func (x *Enum) Reset() { *x = Enum{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -914,7 +977,7 @@ func (x *Enum) String() string { func (*Enum) ProtoMessage() {} func (x *Enum) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[10] + mi := &file_plugin_codegen_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -927,7 +990,7 @@ func (x *Enum) ProtoReflect() protoreflect.Message { // Deprecated: Use Enum.ProtoReflect.Descriptor instead. func (*Enum) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{10} + return file_plugin_codegen_proto_rawDescGZIP(), []int{11} } func (x *Enum) GetName() string { @@ -964,7 +1027,7 @@ type Table struct { func (x *Table) Reset() { *x = Table{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -977,7 +1040,7 @@ func (x *Table) String() string { func (*Table) ProtoMessage() {} func (x *Table) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[11] + mi := &file_plugin_codegen_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -990,7 +1053,7 @@ func (x *Table) ProtoReflect() protoreflect.Message { // Deprecated: Use Table.ProtoReflect.Descriptor instead. func (*Table) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{11} + return file_plugin_codegen_proto_rawDescGZIP(), []int{12} } func (x *Table) GetRel() *Identifier { @@ -1027,7 +1090,7 @@ type Identifier struct { func (x *Identifier) Reset() { *x = Identifier{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1040,7 +1103,7 @@ func (x *Identifier) String() string { func (*Identifier) ProtoMessage() {} func (x *Identifier) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1053,7 +1116,7 @@ func (x *Identifier) ProtoReflect() protoreflect.Message { // Deprecated: Use Identifier.ProtoReflect.Descriptor instead. func (*Identifier) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{12} + return file_plugin_codegen_proto_rawDescGZIP(), []int{13} } func (x *Identifier) GetCatalog() string { @@ -1100,7 +1163,7 @@ type Column struct { func (x *Column) Reset() { *x = Column{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1113,7 +1176,7 @@ func (x *Column) String() string { func (*Column) ProtoMessage() {} func (x *Column) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[13] + mi := &file_plugin_codegen_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1126,7 +1189,7 @@ func (x *Column) ProtoReflect() protoreflect.Message { // Deprecated: Use Column.ProtoReflect.Descriptor instead. func (*Column) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{13} + return file_plugin_codegen_proto_rawDescGZIP(), []int{14} } func (x *Column) GetName() string { @@ -1231,7 +1294,7 @@ type Query struct { func (x *Query) Reset() { *x = Query{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1244,7 +1307,7 @@ func (x *Query) String() string { func (*Query) ProtoMessage() {} func (x *Query) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1257,7 +1320,7 @@ func (x *Query) ProtoReflect() protoreflect.Message { // Deprecated: Use Query.ProtoReflect.Descriptor instead. func (*Query) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{14} + return file_plugin_codegen_proto_rawDescGZIP(), []int{15} } func (x *Query) GetText() string { @@ -1328,7 +1391,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) } @@ -1341,7 +1404,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 { @@ -1354,7 +1417,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 { @@ -1384,7 +1447,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) } @@ -1397,7 +1460,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 { @@ -1410,7 +1473,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 { @@ -1445,7 +1508,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) } @@ -1458,7 +1521,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 { @@ -1471,7 +1534,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 { @@ -1626,7 +1689,7 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x07, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x22, - 0x81, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, + 0xc1, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x61, 0x62, 0x6c, @@ -1634,85 +1697,93 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x6e, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x06, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, - 0x75, 0x6d, 0x73, 0x22, 0x48, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, - 0x61, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, - 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 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, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, 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, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x22, 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xf2, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, - 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, - 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, - 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, - 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, - 0x6c, 0x65, 0x18, 0x0a, 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, 0x05, 0x74, 0x61, - 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, - 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, - 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, + 0x75, 0x6d, 0x73, 0x12, 0x3e, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x0e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x73, 0x22, 0x3d, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x22, 0x48, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x76, 0x61, + 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x71, 0x0a, 0x05, + 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x72, 0x65, 0x6c, 0x18, 0x01, 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, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, - 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x90, 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, 0x3c, - 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x0f, 0x49, 0x6e, 0x73, - 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x92, 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, 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, 0x42, 0x2c, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x03, 0x72, 0x65, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x02, 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, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, + 0x52, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, + 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0xf2, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, + 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, + 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x18, 0x0a, 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, 0x05, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, + 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, + 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 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, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, + 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x90, 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, 0x3c, 0x0a, + 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x0f, 0x49, 0x6e, 0x73, 0x65, + 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x92, 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, 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, 0x42, 0x2c, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1727,7 +1798,7 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_plugin_codegen_proto_goTypes = []interface{}{ (*File)(nil), // 0: plugin.File (*Override)(nil), // 1: plugin.Override @@ -1739,45 +1810,47 @@ var file_plugin_codegen_proto_goTypes = []interface{}{ (*GoCode)(nil), // 7: plugin.GoCode (*Catalog)(nil), // 8: plugin.Catalog (*Schema)(nil), // 9: plugin.Schema - (*Enum)(nil), // 10: plugin.Enum - (*Table)(nil), // 11: plugin.Table - (*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 - nil, // 18: plugin.Settings.RenameEntry + (*CompositeType)(nil), // 10: plugin.CompositeType + (*Enum)(nil), // 11: plugin.Enum + (*Table)(nil), // 12: plugin.Table + (*Identifier)(nil), // 13: plugin.Identifier + (*Column)(nil), // 14: plugin.Column + (*Query)(nil), // 15: plugin.Query + (*Parameter)(nil), // 16: plugin.Parameter + (*CodeGenRequest)(nil), // 17: plugin.CodeGenRequest + (*CodeGenResponse)(nil), // 18: plugin.CodeGenResponse + nil, // 19: plugin.Settings.RenameEntry } var file_plugin_codegen_proto_depIdxs = []int32{ - 12, // 0: plugin.Override.table:type_name -> plugin.Identifier + 13, // 0: plugin.Override.table:type_name -> plugin.Identifier 2, // 1: plugin.Override.python_type:type_name -> plugin.PythonType 3, // 2: plugin.Override.go_type:type_name -> plugin.ParsedGoType - 18, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry + 19, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry 1, // 4: plugin.Settings.overrides:type_name -> plugin.Override 5, // 5: plugin.Settings.python:type_name -> plugin.PythonCode 6, // 6: plugin.Settings.kotlin:type_name -> plugin.KotlinCode 7, // 7: plugin.Settings.go:type_name -> plugin.GoCode 9, // 8: plugin.Catalog.schemas:type_name -> plugin.Schema - 11, // 9: plugin.Schema.tables:type_name -> plugin.Table - 10, // 10: plugin.Schema.enums:type_name -> plugin.Enum - 12, // 11: plugin.Table.rel:type_name -> plugin.Identifier - 13, // 12: plugin.Table.columns:type_name -> plugin.Column - 12, // 13: plugin.Column.table:type_name -> plugin.Identifier - 12, // 14: plugin.Column.type:type_name -> plugin.Identifier - 13, // 15: plugin.Query.columns:type_name -> plugin.Column - 15, // 16: plugin.Query.params:type_name -> plugin.Parameter - 12, // 17: plugin.Query.InsertIntoTable:type_name -> plugin.Identifier - 13, // 18: plugin.Parameter.column:type_name -> plugin.Column - 4, // 19: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 8, // 20: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 14, // 21: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 22: plugin.CodeGenResponse.files:type_name -> plugin.File - 23, // [23:23] is the sub-list for method output_type - 23, // [23:23] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 12, // 9: plugin.Schema.tables:type_name -> plugin.Table + 11, // 10: plugin.Schema.enums:type_name -> plugin.Enum + 10, // 11: plugin.Schema.composite_types:type_name -> plugin.CompositeType + 13, // 12: plugin.Table.rel:type_name -> plugin.Identifier + 14, // 13: plugin.Table.columns:type_name -> plugin.Column + 13, // 14: plugin.Column.table:type_name -> plugin.Identifier + 13, // 15: plugin.Column.type:type_name -> plugin.Identifier + 14, // 16: plugin.Query.columns:type_name -> plugin.Column + 16, // 17: plugin.Query.params:type_name -> plugin.Parameter + 13, // 18: plugin.Query.InsertIntoTable:type_name -> plugin.Identifier + 14, // 19: plugin.Parameter.column:type_name -> plugin.Column + 4, // 20: plugin.CodeGenRequest.settings:type_name -> plugin.Settings + 8, // 21: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog + 15, // 22: plugin.CodeGenRequest.queries:type_name -> plugin.Query + 0, // 23: plugin.CodeGenResponse.files:type_name -> plugin.File + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name } func init() { file_plugin_codegen_proto_init() } @@ -1907,7 +1980,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Enum); i { + switch v := v.(*CompositeType); i { case 0: return &v.state case 1: @@ -1919,7 +1992,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Table); i { + switch v := v.(*Enum); i { case 0: return &v.state case 1: @@ -1931,7 +2004,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Identifier); i { + switch v := v.(*Table); i { case 0: return &v.state case 1: @@ -1943,7 +2016,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Column); i { + switch v := v.(*Identifier); i { case 0: return &v.state case 1: @@ -1955,7 +2028,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Query); i { + switch v := v.(*Column); i { case 0: return &v.state case 1: @@ -1967,7 +2040,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.(*Query); i { case 0: return &v.state case 1: @@ -1979,7 +2052,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: @@ -1991,6 +2064,18 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CodeGenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_plugin_codegen_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CodeGenResponse); i { case 0: return &v.state @@ -2009,7 +2094,7 @@ func file_plugin_codegen_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 19, + NumMessages: 20, NumExtensions: 0, NumServices: 0, }, diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index ea2f1a4abf..ffb4e5a535 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -114,6 +114,13 @@ message Schema string name = 2; repeated Table tables = 3; repeated Enum enums = 4; + repeated CompositeType composite_types = 5; +} + +message CompositeType +{ + string name = 1; + string comment = 2; } message Enum From 433c059a9bbd2ed3e0527ce6b665af870040bede Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Mon, 28 Feb 2022 21:12:23 -0600 Subject: [PATCH 4/7] oops --- internal/cmd/generate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 6c829edb4f..4c9025641d 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -187,6 +187,7 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer if debug.Traced { region = trace.StartRegion(ctx, "codegen") } + var files map[string]string var resp *plugin.CodeGenResponse var out string switch { @@ -206,8 +207,8 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer region.End() } - files := map[string]string{} if resp != nil { + files = map[string]string{} for _, file := range resp.Files { files[file.Name] = string(file.Contents) } From 03dcc2191260907f6b34d00da8972020ecc63dc5 Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Tue, 1 Mar 2022 11:07:24 -0600 Subject: [PATCH 5/7] convert to spaces, fix up insert_into_table --- protos/plugin/codegen.proto | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index ffb4e5a535..2c226ff7d7 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -11,23 +11,23 @@ message File } message Override { - // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` - string code_type = 1 [json_name="code_type"]; + // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` + string code_type = 1 [json_name="code_type"]; - // name of the type to use, e.g. `text` - string db_type = 3 [json_name="db_type"]; + // name of the type to use, e.g. `text` + string db_type = 3 [json_name="db_type"]; - // True if the override should apply to a nullable database type - bool nullable = 5 [json_name="nullable"]; + // True if the override should apply to a nullable database type + bool nullable = 5 [json_name="nullable"]; - // fully qualified name of the column, e.g. `accounts.id` - string column = 6 [json_name="column"]; + // fully qualified name of the column, e.g. `accounts.id` + string column = 6 [json_name="column"]; - Identifier table = 7 [json_name="table"]; + Identifier table = 7 [json_name="table"]; - string column_name = 8 [json_name="column_name"]; + string column_name = 8 [json_name="column_name"]; - PythonType python_type = 9; + PythonType python_type = 9; ParsedGoType go_type = 10; } @@ -139,9 +139,9 @@ message Table message Identifier { - string catalog = 1; - string schema = 2; - string name = 3; + string catalog = 1; + string schema = 2; + string name = 3; } message Column @@ -171,7 +171,7 @@ message Query repeated Parameter params = 5 [json_name="parameters"]; repeated string comments = 6 [json_name="comments"]; string filename = 7 [json_name="filename"]; - Identifier InsertIntoTable = 8; + Identifier insert_into_table = 8 [json_name="insert_into_table"]; } message Parameter From 0e89cebf37565d4bfa9fb9138636401ad7684e2c Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Tue, 1 Mar 2022 11:11:37 -0600 Subject: [PATCH 6/7] remove use of core.FQN from sameTableName --- internal/codegen/golang/compat.go | 11 +++++------ internal/codegen/golang/result.go | 5 ++--- internal/codegen/golang/struct.go | 3 +-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/internal/codegen/golang/compat.go b/internal/codegen/golang/compat.go index 44b6d9549e..ae2c902f57 100644 --- a/internal/codegen/golang/compat.go +++ b/internal/codegen/golang/compat.go @@ -1,17 +1,16 @@ package golang import ( - "github.com/kyleconroy/sqlc/internal/core" "github.com/kyleconroy/sqlc/internal/plugin" ) -func sameTableName(n *plugin.Identifier, f core.FQN, defaultSchema string) bool { - if n == nil { +func sameTableName(tableID, f *plugin.Identifier, defaultSchema string) bool { + if tableID == nil { return false } - schema := n.Schema - if n.Schema == "" { + schema := tableID.Schema + if tableID.Schema == "" { schema = defaultSchema } - return n.Catalog == f.Catalog && schema == f.Schema && n.Name == f.Rel + return tableID.Catalog == f.Catalog && schema == f.Schema && tableID.Name == f.Name } diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 99ba260bf8..5c3fb8fef2 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/core" "github.com/kyleconroy/sqlc/internal/inflection" "github.com/kyleconroy/sqlc/internal/plugin" ) @@ -68,7 +67,7 @@ func buildStructs(req *plugin.CodeGenRequest) []Struct { structName = inflection.Singular(structName) } s := Struct{ - Table: core.FQN{Schema: schema.Name, Rel: table.Rel.Name}, + Table: plugin.Identifier{Schema: schema.Name, Name: table.Rel.Name}, Name: StructName(structName, req.Settings), Comment: table.Comment, } @@ -210,7 +209,7 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) c := query.Columns[i] sameName := f.Name == StructName(columnName(c, i), req.Settings) sameType := f.Type == goType(req, c) - sameTable := sameTableName(c.Table, s.Table, req.Catalog.DefaultSchema) + sameTable := sameTableName(c.Table, &s.Table, req.Catalog.DefaultSchema) if !sameName || !sameType || !sameTable { same = false } diff --git a/internal/codegen/golang/struct.go b/internal/codegen/golang/struct.go index f5b96e1ffe..1d36e92aba 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -3,12 +3,11 @@ package golang import ( "strings" - "github.com/kyleconroy/sqlc/internal/core" "github.com/kyleconroy/sqlc/internal/plugin" ) type Struct struct { - Table core.FQN + Table plugin.Identifier Name string Fields []Field Comment string From 32f4c968857273582f71d01b72fdf85589548f1d Mon Sep 17 00:00:00 2001 From: Stephen Wan Date: Tue, 1 Mar 2022 11:13:13 -0600 Subject: [PATCH 7/7] remove notes to self --- internal/codegen/golang/gen.go | 7 --- internal/codegen/golang/go_type.go | 2 +- internal/codegen/golang/imports.go | 2 +- internal/codegen/golang/mysql_type.go | 1 - internal/codegen/golang/postgresql_type.go | 1 - internal/codegen/golang/result.go | 2 +- internal/plugin/codegen.pb.go | 69 +++++++++++----------- protos/plugin/codegen.proto | 1 - 8 files changed, 37 insertions(+), 48 deletions(-) diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index 82828855fc..b938675afd 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -10,17 +10,10 @@ import ( "text/template" "github.com/kyleconroy/sqlc/internal/codegen" - "github.com/kyleconroy/sqlc/internal/config" "github.com/kyleconroy/sqlc/internal/metadata" "github.com/kyleconroy/sqlc/internal/plugin" ) -type Generateable interface { - Structs(settings config.CombinedSettings) []Struct - GoQueries(settings config.CombinedSettings) []Query - Enums(settings config.CombinedSettings) []Enum -} - type tmplCtx struct { Q string Package string diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index f0320761a2..5ea995c84d 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -5,7 +5,7 @@ import ( "github.com/kyleconroy/sqlc/internal/plugin" ) -// XXX: dedupe +// XXX: These are copied from python codegen. func matchString(pat, target string) bool { matcher, err := pattern.MatchCompile(pat) if err != nil { diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index 9140b65c66..72c97b4fea 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -225,7 +225,7 @@ func buildImports(settings *plugin.Settings, queries []Query, uses func(string) if o.GoType.BasicType || o.GoType.TypeName == "" { continue } - _, alreadyImported := std[o.GoType.ImportPath] // XXX + _, alreadyImported := std[o.GoType.ImportPath] hasPackageAlias := o.GoType.Package != "" if (!alreadyImported || hasPackageAlias) && uses(o.GoType.TypeName) { pkg[ImportSpec{Path: o.GoType.ImportPath, ID: o.GoType.Package}] = struct{}{} diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index 0d10edd6ed..af72ba849b 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -28,7 +28,6 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { return "sql.NullString" case "tinyint": - // XXX: is this still right? if col.Length == 1 { if notNull { return "bool" diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index e73a73cd72..1a4b995e6e 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -263,7 +263,6 @@ func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { } for _, ct := range schema.CompositeTypes { - // XXX: old code had a bug? if rel.Name == ct.Name && rel.Schema == schema.Name { if notNull { return "string" diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 5c3fb8fef2..4a4b293a4d 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -168,7 +168,7 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) var cols []goColumn for _, p := range query.Params { cols = append(cols, goColumn{ - id: int(p.Number), // XXX: ?? + id: int(p.Number), Column: p.Column, }) } diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 5b69e0f68a..6c2a7f02ce 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -580,12 +580,11 @@ type GoCode struct { JsonTagsCaseStyle string `protobuf:"bytes,11,opt,name=json_tags_case_style,json=jsonTagsCaseStyle,proto3" json:"json_tags_case_style,omitempty"` Package string `protobuf:"bytes,12,opt,name=package,proto3" json:"package,omitempty"` Out string `protobuf:"bytes,13,opt,name=out,proto3" json:"out,omitempty"` - // XXX: overrides, rename, is part of the parent? - SqlPackage string `protobuf:"bytes,14,opt,name=sql_package,json=sqlPackage,proto3" json:"sql_package,omitempty"` - OutputDbFileName string `protobuf:"bytes,15,opt,name=output_db_file_name,json=outputDbFileName,proto3" json:"output_db_file_name,omitempty"` - OutputModelsFileName string `protobuf:"bytes,16,opt,name=output_models_file_name,json=outputModelsFileName,proto3" json:"output_models_file_name,omitempty"` - OutputQuerierFileName string `protobuf:"bytes,17,opt,name=output_querier_file_name,json=outputQuerierFileName,proto3" json:"output_querier_file_name,omitempty"` - OutputFilesSuffix string `protobuf:"bytes,18,opt,name=output_files_suffix,json=outputFilesSuffix,proto3" json:"output_files_suffix,omitempty"` + SqlPackage string `protobuf:"bytes,14,opt,name=sql_package,json=sqlPackage,proto3" json:"sql_package,omitempty"` + OutputDbFileName string `protobuf:"bytes,15,opt,name=output_db_file_name,json=outputDbFileName,proto3" json:"output_db_file_name,omitempty"` + OutputModelsFileName string `protobuf:"bytes,16,opt,name=output_models_file_name,json=outputModelsFileName,proto3" json:"output_models_file_name,omitempty"` + OutputQuerierFileName string `protobuf:"bytes,17,opt,name=output_querier_file_name,json=outputQuerierFileName,proto3" json:"output_querier_file_name,omitempty"` + OutputFilesSuffix string `protobuf:"bytes,18,opt,name=output_files_suffix,json=outputFilesSuffix,proto3" json:"output_files_suffix,omitempty"` } func (x *GoCode) Reset() { @@ -1288,7 +1287,7 @@ type Query struct { 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"` Filename string `protobuf:"bytes,7,opt,name=filename,proto3" json:"filename,omitempty"` - InsertIntoTable *Identifier `protobuf:"bytes,8,opt,name=InsertIntoTable,proto3" json:"InsertIntoTable,omitempty"` + InsertIntoTable *Identifier `protobuf:"bytes,8,opt,name=insert_into_table,proto3" json:"insert_into_table,omitempty"` } func (x *Query) Reset() { @@ -1745,7 +1744,7 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x90, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, + 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x94, 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, @@ -1758,32 +1757,32 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 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, 0x3c, 0x0a, - 0x0f, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x0f, 0x49, 0x6e, 0x73, 0x65, - 0x72, 0x74, 0x49, 0x6e, 0x74, 0x6f, 0x54, 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, 0x92, 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, 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, 0x42, 0x2c, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x92, 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, 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, 0x42, 0x2c, 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, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1840,7 +1839,7 @@ var file_plugin_codegen_proto_depIdxs = []int32{ 13, // 15: plugin.Column.type:type_name -> plugin.Identifier 14, // 16: plugin.Query.columns:type_name -> plugin.Column 16, // 17: plugin.Query.params:type_name -> plugin.Parameter - 13, // 18: plugin.Query.InsertIntoTable:type_name -> plugin.Identifier + 13, // 18: plugin.Query.insert_into_table:type_name -> plugin.Identifier 14, // 19: plugin.Parameter.column:type_name -> plugin.Column 4, // 20: plugin.CodeGenRequest.settings:type_name -> plugin.Settings 8, // 21: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index 2c226ff7d7..9c9b3dce68 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -92,7 +92,6 @@ message GoCode string json_tags_case_style = 11; string package = 12; string out = 13; - // XXX: overrides, rename, is part of the parent? string sql_package = 14; string output_db_file_name = 15; string output_models_file_name = 16;