diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 8823224636..4c9025641d 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -193,7 +193,7 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer 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)) diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index e7f2fea697..e879b33c80 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, @@ -88,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 { @@ -136,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{ @@ -161,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 @@ -180,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/compat.go b/internal/codegen/golang/compat.go index cdbb5aac2a..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/sql/ast" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func sameTableName(n *ast.TableName, 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/driver.go b/internal/codegen/golang/driver.go index de2e201b8c..b9efe77abf 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,8 +11,8 @@ const ( SQLDriverLibPQ ) -func parseDriver(settings config.CombinedSettings) SQLDriver { - if settings.Go.SQLPackage == "pgx/v4" { +func parseDriver(settings *plugin.Settings) SQLDriver { + 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 bb095e8a62..6b22c8798b 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,8 +28,8 @@ func (gf Field) Tag() string { return strings.Join(tags, " ") } -func JSONTagName(name string, settings config.CombinedSettings) string { - style := settings.Go.JSONTagsCaseStyle +func JSONTagName(name string, settings *plugin.Settings) string { + style := settings.Go.JsonTagsCaseStyle if style == "" || style == "none" { return name } else { diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index 522cdb1b4f..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/compiler" - "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 @@ -28,7 +21,6 @@ type tmplCtx struct { Enums []Enum Structs []Struct GoQueries []Query - Settings config.Config // TODO: Race conditions SourceName string @@ -47,19 +39,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 +75,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 +130,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 +178,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..5ea995c84d 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -1,50 +1,92 @@ package golang import ( - "github.com/kyleconroy/sqlc/internal/compiler" - "github.com/kyleconroy/sqlc/internal/config" + "github.com/kyleconroy/sqlc/internal/pattern" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func goType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { +// XXX: These are copied from python codegen. +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 settings.Overrides { - if oride.GoTypeName == "" { + for _, oride := range req.Settings.Overrides { + if oride.GoType.TypeName == "" { continue } - sameTable := oride.Matches(col.Table, r.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(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 { - 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 settings.Overrides { - if oride.GoTypeName == "" { + for _, oride := range req.Settings.Overrides { + 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 } } // 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 "postgresql": + 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..72c97b4fea 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 { @@ -201,10 +201,10 @@ func buildImports(settings config.CombinedSettings, queries []Query, uses func(s 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 config.CombinedSettings, queries []Query, uses func(s // 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] + hasPackageAlias := o.GoType.Package != "" + if (!alreadyImported || hasPackageAlias) && uses(o.GoType.TypeName) { + pkg[ImportSpec{Path: o.GoType.ImportPath, ID: o.GoType.Package}] = struct{}{} } } @@ -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..af72ba849b 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -3,14 +3,20 @@ package golang 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 { - 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 { @@ -22,7 +28,7 @@ func mysqlType(r *compiler.Result, col *compiler.Column, settings config.Combine return "sql.NullString" case "tinyint": - if col.Length != nil && *col.Length == 1 { + if col.Length == 1 { if notNull { return "bool" } @@ -84,16 +90,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..1a4b995e6e 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -4,15 +4,14 @@ 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 postgresType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) string { - columnType := col.DataType +func postgresType(req *plugin.CodeGenRequest, col *plugin.Column) string { + columnType := dataType(col.Type) notNull := col.NotNull || col.IsArray - driver := parseDriver(settings) + driver := parseDriver(req.Settings) switch columnType { case "serial", "serial4", "pg_catalog.serial4": @@ -246,23 +245,25 @@ 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 } - 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) + + 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) } - case *catalog.CompositeType: + return StructName(schema.Name+"_"+enum.Name, req.Settings) + } + } + + for _, ct := range schema.CompositeTypes { + if rel.Name == ct.Name && rel.Schema == schema.Name { 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..4a4b293a4d 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -6,32 +6,25 @@ import ( "strings" "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 +34,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 +49,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), + Table: plugin.Identifier{Schema: schema.Name, Name: table.Rel.Name}, + 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, }) @@ -104,17 +97,17 @@ func buildStructs(r *compiler.Result, settings config.CombinedSettings) []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 } 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 +128,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 +139,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 +151,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), 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 +181,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 +193,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 +207,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 +229,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 +240,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 +257,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 +266,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 +282,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..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/config" + "github.com/kyleconroy/sqlc/internal/plugin" ) -func sqliteType(r *compiler.Result, col *compiler.Column, settings config.CombinedSettings) 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/codegen/golang/struct.go b/internal/codegen/golang/struct.go index 74be48e3f3..1d36e92aba 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -3,18 +3,17 @@ 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 { - Table core.FQN + Table plugin.Identifier Name string Fields []Field 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..6c2a7f02ce 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 @@ -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 @@ -243,12 +322,13 @@ 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() { *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) } @@ -261,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 { @@ -274,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 { @@ -333,6 +413,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 @@ -348,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) } @@ -361,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 { @@ -374,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 { @@ -425,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) } @@ -438,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 { @@ -451,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 { @@ -475,6 +562,189 @@ 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"` + 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[7] + 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[7] + 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{7} +} + +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 +759,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[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -502,7 +772,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[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -515,7 +785,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{8} } func (x *Catalog) GetComment() string { @@ -551,16 +821,17 @@ 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() { *x = Schema{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -573,7 +844,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[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -586,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{7} + return file_plugin_codegen_proto_rawDescGZIP(), []int{9} } func (x *Schema) GetComment() string { @@ -617,6 +888,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 @@ -630,7 +963,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[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -643,7 +976,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[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -656,7 +989,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{11} } func (x *Enum) GetName() string { @@ -693,7 +1026,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[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -706,7 +1039,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[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -719,7 +1052,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{12} } func (x *Table) GetRel() *Identifier { @@ -756,7 +1089,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[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -769,7 +1102,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[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -782,7 +1115,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{13} } func (x *Identifier) GetCatalog() string { @@ -829,7 +1162,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[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -842,7 +1175,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[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -855,7 +1188,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{14} } func (x *Column) GetName() string { @@ -947,19 +1280,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=insert_into_table,proto3" json:"insert_into_table,omitempty"` } func (x *Query) Reset() { *x = Query{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -972,7 +1306,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[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -985,7 +1319,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{15} } func (x *Query) GetText() string { @@ -1037,6 +1371,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 +1390,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[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1062,7 +1403,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[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1075,7 +1416,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{16} } func (x *Parameter) GetNumber() int32 { @@ -1105,7 +1446,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[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1118,7 +1459,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[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1131,7 +1472,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{17} } func (x *CodeGenRequest) GetSettings() *Settings { @@ -1166,7 +1507,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[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1179,7 +1520,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[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1192,7 +1533,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{18} } func (x *CodeGenResponse) GetFiles() []*File { @@ -1210,7 +1551,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, @@ -1226,144 +1567,222 @@ 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, 0xe7, 0x02, 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, 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, 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, + 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, + 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, + 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, 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, 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, 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, 0xd2, 0x01, 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, 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, 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, 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, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x28, 0x0a, 0x07, + 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x07, 0x63, + 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x40, 0x0a, + 0x11, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x69, 0x6e, + 0x73, 0x65, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x6f, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, + 0x4b, 0x0a, 0x09, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, + 0x6c, 0x75, 0x6d, 0x6e, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x22, 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,52 +1797,59 @@ 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, 20) 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 - (*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 + (*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 + (*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{ - 10, // 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 - 16, // 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 + 3, // 2: plugin.Override.go_type:type_name -> plugin.ParsedGoType + 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 + 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.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 + 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() } @@ -1469,7 +1895,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: @@ -1481,7 +1907,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: @@ -1493,7 +1919,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: @@ -1505,7 +1931,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.(*KotlinCode); i { case 0: return &v.state case 1: @@ -1517,7 +1943,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.(*GoCode); i { case 0: return &v.state case 1: @@ -1529,7 +1955,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.(*Catalog); i { case 0: return &v.state case 1: @@ -1541,7 +1967,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.(*Schema); i { case 0: return &v.state case 1: @@ -1553,7 +1979,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.(*CompositeType); i { case 0: return &v.state case 1: @@ -1565,7 +1991,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.(*Enum); i { case 0: return &v.state case 1: @@ -1577,7 +2003,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.(*Table); i { case 0: return &v.state case 1: @@ -1589,7 +2015,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.(*Identifier); i { case 0: return &v.state case 1: @@ -1601,7 +2027,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.(*Column); i { case 0: return &v.state case 1: @@ -1613,6 +2039,42 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Query); 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.(*Parameter); 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.(*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 @@ -1631,7 +2093,7 @@ func file_plugin_codegen_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 17, + NumMessages: 20, 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..9c9b3dce68 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -11,23 +11,25 @@ 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; } 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 { @@ -49,6 +58,7 @@ message Settings // TODO: Refactor codegen settings PythonCode python = 8; KotlinCode kotlin = 9; + GoCode go = 10; } message PythonCode @@ -67,6 +77,28 @@ 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; + 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; @@ -81,6 +113,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 @@ -99,9 +138,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 @@ -131,6 +170,7 @@ message Query repeated Parameter params = 5 [json_name="parameters"]; repeated string comments = 6 [json_name="comments"]; string filename = 7 [json_name="filename"]; + Identifier insert_into_table = 8 [json_name="insert_into_table"]; } message Parameter