diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edef06cd6c..7ed62894b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,6 +54,10 @@ jobs: - name: install ./... run: go install ./... + - name: build internal/endtoend + run: go build ./... + working-directory: internal/endtoend/testdata + - name: test ./... run: gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./... env: @@ -65,16 +69,6 @@ jobs: CI_SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} SQLC_AUTH_TOKEN: ${{ secrets.CI_SQLC_AUTH_TOKEN }} - - name: build internal/endtoend - run: go build ./... - working-directory: internal/endtoend/testdata - - - name: report - if: false - run: ./scripts/report.sh - env: - BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }} - vuln_check: runs-on: ubuntu-latest timeout-minutes: 5 diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 35a5f06e4e..033226e8bf 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -411,10 +411,19 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re opts, err := convert.YAMLtoJSON(sql.Plugin.Options) if err != nil { - return "", nil, fmt.Errorf("invalid plugin options") + return "", nil, fmt.Errorf("invalid plugin options: %w", err) } req.PluginOptions = opts + global, found := combo.Global.Options[plug.Name] + if found { + opts, err := convert.YAMLtoJSON(global) + if err != nil { + return "", nil, fmt.Errorf("invalid global options: %w", err) + } + req.GlobalOptions = opts + } + case sql.Gen.Go != nil: out = combo.Go.Out handler = ext.HandleFunc(golang.Generate) @@ -424,6 +433,14 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re } req.PluginOptions = opts + if combo.Global.Overrides.Go != nil { + opts, err := json.Marshal(combo.Global.Overrides.Go) + if err != nil { + return "", nil, fmt.Errorf("opts marshal failed: %w", err) + } + req.GlobalOptions = opts + } + case sql.Gen.JSON != nil: out = combo.JSON.Out handler = ext.HandleFunc(genjson.Generate) diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 587c8bff6d..194afd0c81 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -1,8 +1,6 @@ package cmd import ( - "strings" - "github.com/sqlc-dev/sqlc/internal/compiler" "github.com/sqlc-dev/sqlc/internal/config" "github.com/sqlc-dev/sqlc/internal/config/convert" @@ -11,53 +9,13 @@ import ( "github.com/sqlc-dev/sqlc/internal/sql/catalog" ) -func pluginOverride(r *compiler.Result, o config.Override) *plugin.Override { - var column string - var table plugin.Identifier - - if o.Column != "" { - colParts := strings.Split(o.Column, ".") - switch len(colParts) { - case 2: - table.Schema = r.Catalog.DefaultSchema - table.Name = colParts[0] - column = colParts[1] - case 3: - table.Schema = colParts[0] - table.Name = colParts[1] - column = colParts[2] - case 4: - table.Catalog = colParts[0] - table.Schema = colParts[1] - table.Name = colParts[2] - column = colParts[3] - } - } - return &plugin.Override{ - CodeType: "", // FIXME - DbType: o.DBType, - Nullable: o.Nullable, - Unsigned: o.Unsigned, - Column: o.Column, - ColumnName: column, - Table: &table, - GoType: pluginGoType(o), - } -} - func pluginSettings(r *compiler.Result, cs config.CombinedSettings) *plugin.Settings { - var over []*plugin.Override - for _, o := range cs.Overrides { - over = append(over, pluginOverride(r, o)) - } return &plugin.Settings{ - Version: cs.Global.Version, - Engine: string(cs.Package.Engine), - Schema: []string(cs.Package.Schema), - Queries: []string(cs.Package.Queries), - Overrides: over, - Rename: cs.Rename, - Codegen: pluginCodegen(cs, cs.Codegen), + Version: cs.Global.Version, + Engine: string(cs.Package.Engine), + Schema: []string(cs.Package.Schema), + Queries: []string(cs.Package.Queries), + Codegen: pluginCodegen(cs, cs.Codegen), } } @@ -101,20 +59,6 @@ func pluginWASM(p config.Plugin) *plugin.Codegen_WASM { return nil } -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/v1.18.0/reference/config.html#type-overriding - return &plugin.ParsedGoType{ - ImportPath: o.GoImportPath, - Package: o.GoPackage, - TypeName: o.GoTypeName, - BasicType: o.GoBasicType, - StructTags: o.GoStructTags, - } -} - func pluginCatalog(c *catalog.Catalog) *plugin.Catalog { var schemas []*plugin.Schema for _, s := range c.Schemas { diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index 6daa977872..9a2fe5f26c 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -104,7 +104,7 @@ func (t *tmplCtx) codegenQueryRetval(q Query) (string, error) { } func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - options, err := opts.ParseOpts(req) + options, err := opts.Parse(req) if err != nil { return nil, err } @@ -129,11 +129,10 @@ func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenR func generate(req *plugin.CodeGenRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { i := &importer{ - Settings: req.Settings, - Options: options, - Queries: queries, - Enums: enums, - Structs: structs, + Options: options, + Queries: queries, + Enums: enums, + Structs: structs, } tctx := tmplCtx{ diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index 6adb4b5058..f3f52a5097 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -8,12 +8,13 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, col *plugin.Column) { - for _, oride := range req.Settings.Overrides { +func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) { + for _, override := range options.Overrides { + oride := override.ShimOverride if oride.GoType.StructTags == nil { continue } - if !sdk.Matches(oride, col.Table, req.Catalog.DefaultSchema) { + if !override.Matches(col.Table, req.Catalog.DefaultSchema) { // Different table. continue } @@ -34,7 +35,9 @@ func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, co func goType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { // Check if the column's type has been overridden - for _, oride := range req.Settings.Overrides { + for _, override := range options.Overrides { + oride := override.ShimOverride + if oride.GoType.TypeName == "" { continue } @@ -42,7 +45,7 @@ func goType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Colum if col.OriginalName != "" { cname = col.OriginalName } - sameTable := sdk.Matches(oride, col.Table, req.Catalog.DefaultSchema) + sameTable := override.Matches(col.Table, req.Catalog.DefaultSchema) if oride.Column != "" && sdk.MatchString(oride.ColumnName, cname) && sameTable { if col.IsSqlcSlice { return "[]" + oride.GoType.TypeName @@ -65,7 +68,8 @@ func goInnerType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin. notNull := col.NotNull || col.IsArray // package overrides have a higher precedence - for _, oride := range req.Settings.Overrides { + for _, override := range options.Overrides { + oride := override.ShimOverride if oride.GoType.TypeName == "" { continue } @@ -77,7 +81,7 @@ func goInnerType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin. // TODO: Extend the engine interface to handle types switch req.Settings.Engine { case "mysql": - return mysqlType(req, col) + return mysqlType(req, options, col) case "postgresql": return postgresType(req, options, col) case "sqlite": diff --git a/internal/codegen/golang/imports.go b/internal/codegen/golang/imports.go index c436e68e99..83f72cd78a 100644 --- a/internal/codegen/golang/imports.go +++ b/internal/codegen/golang/imports.go @@ -7,7 +7,6 @@ import ( "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/metadata" - "github.com/sqlc-dev/sqlc/internal/plugin" ) type fileImports struct { @@ -59,11 +58,10 @@ func mergeImports(imps ...fileImports) [][]ImportSpec { } type importer struct { - Settings *plugin.Settings - Options *opts.Options - Queries []Query - Enums []Enum - Structs []Struct + Options *opts.Options + Queries []Query + Enums []Enum + Structs []Struct } func (i *importer) usesType(typ string) bool { @@ -157,7 +155,7 @@ var pqtypeTypes = map[string]struct{}{ "pqtype.NullRawMessage": {}, } -func buildImports(settings *plugin.Settings, options *opts.Options, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { +func buildImports(options *opts.Options, queries []Query, uses func(string) bool) (map[string]struct{}, map[ImportSpec]struct{}) { pkg := make(map[ImportSpec]struct{}) std := make(map[string]struct{}) @@ -201,7 +199,8 @@ func buildImports(settings *plugin.Settings, options *opts.Options, queries []Qu } overrideTypes := map[string]string{} - for _, o := range settings.Overrides { + for _, override := range options.Overrides { + o := override.ShimOverride if o.GoType.BasicType || o.GoType.TypeName == "" { continue } @@ -226,7 +225,9 @@ func buildImports(settings *plugin.Settings, options *opts.Options, queries []Qu } // Custom imports - for _, o := range settings.Overrides { + for _, override := range options.Overrides { + o := override.ShimOverride + if o.GoType.BasicType || o.GoType.TypeName == "" { continue } @@ -241,7 +242,7 @@ func buildImports(settings *plugin.Settings, options *opts.Options, queries []Qu } func (i *importer) interfaceImports() fileImports { - std, pkg := buildImports(i.Settings, i.Options, i.Queries, func(name string) bool { + std, pkg := buildImports(i.Options, i.Queries, func(name string) bool { for _, q := range i.Queries { if q.hasRetType() { if usesBatch([]Query{q}) { @@ -266,7 +267,7 @@ func (i *importer) interfaceImports() fileImports { } func (i *importer) modelImports() fileImports { - std, pkg := buildImports(i.Settings, i.Options, nil, i.usesType) + std, pkg := buildImports(i.Options, nil, i.usesType) if len(i.Enums) > 0 { std["fmt"] = struct{}{} @@ -305,7 +306,7 @@ func (i *importer) queryImports(filename string) fileImports { } } - std, pkg := buildImports(i.Settings, i.Options, gq, func(name string) bool { + std, pkg := buildImports(i.Options, gq, func(name string) bool { for _, q := range gq { if q.hasRetType() { if q.Ret.EmitStruct() { @@ -406,7 +407,7 @@ func (i *importer) copyfromImports() fileImports { copyFromQueries = append(copyFromQueries, q) } } - std, pkg := buildImports(i.Settings, i.Options, copyFromQueries, func(name string) bool { + std, pkg := buildImports(i.Options, copyFromQueries, func(name string) bool { for _, q := range copyFromQueries { if q.hasRetType() { if strings.HasPrefix(q.Ret.Type(), name) { @@ -441,7 +442,7 @@ func (i *importer) batchImports() fileImports { batchQueries = append(batchQueries, q) } } - std, pkg := buildImports(i.Settings, i.Options, batchQueries, func(name string) bool { + std, pkg := buildImports(i.Options, batchQueries, func(name string) bool { for _, q := range batchQueries { if q.hasRetType() { if q.Ret.EmitStruct() { diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index c89d8ff3c7..77f993635f 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -3,12 +3,13 @@ package golang import ( "log" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/codegen/sdk" "github.com/sqlc-dev/sqlc/internal/debug" "github.com/sqlc-dev/sqlc/internal/plugin" ) -func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func mysqlType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray unsigned := col.Unsigned @@ -101,14 +102,14 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string { if enum.Name == columnType { if notNull { if schema.Name == req.Catalog.DefaultSchema { - return StructName(enum.Name, req.Settings) + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+enum.Name, req.Settings) + return StructName(schema.Name+"_"+enum.Name, options) } else { if schema.Name == req.Catalog.DefaultSchema { - return "Null" + StructName(enum.Name, req.Settings) + return "Null" + StructName(enum.Name, options) } - return "Null" + StructName(schema.Name+"_"+enum.Name, req.Settings) + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } } } diff --git a/internal/config/go_type.go b/internal/codegen/golang/opts/go_type.go similarity index 93% rename from internal/config/go_type.go rename to internal/codegen/golang/opts/go_type.go index 14765e5f32..5dcb3e8af0 100644 --- a/internal/config/go_type.go +++ b/internal/codegen/golang/opts/go_type.go @@ -1,4 +1,4 @@ -package config +package opts import ( "encoding/json" @@ -16,8 +16,8 @@ type GoType struct { Name string `json:"type" yaml:"type"` Pointer bool `json:"pointer" yaml:"pointer"` Slice bool `json:"slice" yaml:"slice"` - Spec string - BuiltIn bool + Spec string `json:"-"` + BuiltIn bool `json:"-"` } type ParsedGoType struct { @@ -28,6 +28,14 @@ type ParsedGoType struct { StructTag string } +func (o *GoType) MarshalJSON() ([]byte, error) { + if o.Spec != "" { + return json.Marshal(o.Spec) + } + type alias GoType + return json.Marshal(alias(*o)) +} + func (o *GoType) UnmarshalJSON(data []byte) error { var spec string if err := json.Unmarshal(data, &spec); err == nil { @@ -77,7 +85,7 @@ func generatePackageID(importPath string) (string, bool) { } // validate GoType -func (gt GoType) Parse() (*ParsedGoType, error) { +func (gt GoType) parse() (*ParsedGoType, error) { var o ParsedGoType if gt.Spec == "" { @@ -171,7 +179,7 @@ type GoStructTag string // empty string {} // `a:"b"` {"a": "b"} // `a:"b" x:"y,z"` {"a": "b", "x": "y,z"} -func (s GoStructTag) Parse() (map[string]string, error) { +func (s GoStructTag) parse() (map[string]string, error) { m := make(map[string]string) tags, err := structtag.Parse(string(s)) if err != nil { diff --git a/internal/codegen/golang/opts/options.go b/internal/codegen/golang/opts/options.go index 2e07b7a025..6b6e289f39 100644 --- a/internal/codegen/golang/opts/options.go +++ b/internal/codegen/golang/opts/options.go @@ -1,55 +1,86 @@ package opts import ( - "bytes" "encoding/json" "fmt" + "maps" "github.com/sqlc-dev/sqlc/internal/plugin" ) type Options struct { - EmitInterface bool `json:"emit_interface"` - EmitJsonTags bool `json:"emit_json_tags"` - JsonTagsIdUppercase bool `json:"json_tags_id_uppercase"` - EmitDbTags bool `json:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty"` - EmitExportedQueries bool `json:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers"` - EmitMethodsWithDbArgument bool `json:"emit_methods_with_db_argument,omitempty"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty"` - JsonTagsCaseStyle string `json:"json_tags_case_style,omitempty"` - Package string `json:"package"` - Out string `json:"out"` - SqlPackage string `json:"sql_package"` - SqlDriver string `json:"sql_driver"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty"` - OutputDbFileName string `json:"output_db_file_name,omitempty"` - OutputModelsFileName string `json:"output_models_file_name,omitempty"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty"` - OutputCopyfromFileName string `json:"output_copyfrom_file_name,omitempty"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty"` - InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty"` - BuildTags string `json:"build_tags,omitempty"` + EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` + EmitJsonTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` + JsonTagsIdUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` + EmitDbTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` + EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` + EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` + EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` + EmitExportedQueries bool `json:"emit_exported_queries" yaml:"emit_exported_queries` + EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` + EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` + EmitMethodsWithDbArgument bool `json:"emit_methods_with_db_argument,omitempty" yaml:"emit_methods_with_db_argument"` + EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` + EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` + EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` + JsonTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` + Package string `json:"package" yaml:"package"` + Out string `json:"out" yaml:"out"` + Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` + Rename map[string]string `json:"rename,omitempty" yaml:"rename"` + SqlPackage string `json:"sql_package" yaml:"sql_package"` + SqlDriver string `json:"sql_driver" yaml:"sql_driver"` + OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` + OutputDbFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` + OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` + OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_queries_file_name"` + OutputCopyfromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` + OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` + InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` + QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` + OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` +} - // Unused but included in marshaled json we receive - Overrides json.RawMessage `json:"overrides,omitempty"` - Rename json.RawMessage `json:"rename,omitempty"` +type GlobalOptions struct { + Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` + Rename map[string]string `json:"rename,omitempty" yaml:"rename"` } -func ParseOpts(req *plugin.CodeGenRequest) (*Options, error) { - var options *Options - dec := json.NewDecoder(bytes.NewReader(req.PluginOptions)) - dec.DisallowUnknownFields() - if err := dec.Decode(&options); err != nil { - return options, fmt.Errorf("unmarshalling options: %w", err) +func Parse(req *plugin.CodeGenRequest) (*Options, error) { + options, err := parseOpts(req) + if err != nil { + return nil, err + } + global, err := parseGlobalOpts(req) + if err != nil { + return nil, err + } + if len(global.Overrides) > 0 { + options.Overrides = append(global.Overrides, options.Overrides...) + } + if len(global.Rename) > 0 { + if options.Rename == nil { + options.Rename = map[string]string{} + } + maps.Copy(options.Rename, global.Rename) + } + return options, nil +} + +func parseOpts(req *plugin.CodeGenRequest) (*Options, error) { + var options Options + if len(req.PluginOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.PluginOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling plugin options: %w", err) + } + + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } } if options.QueryParameterLimit == nil { @@ -57,7 +88,23 @@ func ParseOpts(req *plugin.CodeGenRequest) (*Options, error) { *options.QueryParameterLimit = 1 } - return options, nil + return &options, nil +} + +func parseGlobalOpts(req *plugin.CodeGenRequest) (*GlobalOptions, error) { + var options GlobalOptions + if len(req.GlobalOptions) == 0 { + return &options, nil + } + if err := json.Unmarshal(req.GlobalOptions, &options); err != nil { + return nil, fmt.Errorf("unmarshalling global options: %w", err) + } + for i := range options.Overrides { + if err := options.Overrides[i].parse(req); err != nil { + return nil, err + } + } + return &options, nil } func ValidateOpts(opts *Options) error { diff --git a/internal/config/override.go b/internal/codegen/golang/opts/override.go similarity index 71% rename from internal/config/override.go rename to internal/codegen/golang/opts/override.go index 0bb050443b..3b7fc531c3 100644 --- a/internal/config/override.go +++ b/internal/codegen/golang/opts/override.go @@ -1,4 +1,4 @@ -package config +package opts import ( "fmt" @@ -6,6 +6,7 @@ import ( "strings" "github.com/sqlc-dev/sqlc/internal/pattern" + "github.com/sqlc-dev/sqlc/internal/plugin" ) type Override struct { @@ -21,7 +22,7 @@ type Override struct { Deprecated_PostgresType string `json:"postgres_type" yaml:"postgres_type"` // for global overrides only when two different engines are in use - Engine Engine `json:"engine,omitempty" yaml:"engine"` + Engine string `json:"engine,omitempty" yaml:"engine"` // True if the GoType should override if the matching type is nullable Nullable bool `json:"nullable" yaml:"nullable"` @@ -35,21 +36,47 @@ type Override struct { // fully qualified name of the column, e.g. `accounts.id` Column string `json:"column" yaml:"column"` - ColumnName *pattern.Match - TableCatalog *pattern.Match - TableSchema *pattern.Match - TableRel *pattern.Match - GoImportPath string - GoPackage string - GoTypeName string - GoBasicType bool + ColumnName *pattern.Match `json:"-"` + TableCatalog *pattern.Match `json:"-"` + TableSchema *pattern.Match `json:"-"` + TableRel *pattern.Match `json:"-"` + GoImportPath string `json:"-"` + GoPackage string `json:"-"` + GoTypeName string `json:"-"` + GoBasicType bool `json:"-"` // Parsed form of GoStructTag, e.g. {"validate:", "required"} - GoStructTags map[string]string + GoStructTags map[string]string `json:"-"` + ShimOverride *ShimOverride `json:"-"` } -func (o *Override) Parse() (err error) { +func (o *Override) Matches(n *plugin.Identifier, defaultSchema string) bool { + if n == nil { + return false + } + schema := n.Schema + if n.Schema == "" { + schema = defaultSchema + } + if o.TableCatalog != nil && !o.TableCatalog.MatchString(n.Catalog) { + return false + } + if o.TableSchema == nil && schema != "" { + return false + } + if o.TableSchema != nil && !o.TableSchema.MatchString(schema) { + return false + } + if o.TableRel == nil && n.Name != "" { + return false + } + if o.TableRel != nil && !o.TableRel.MatchString(n.Name) { + return false + } + return true +} +func (o *Override) parse(req *plugin.CodeGenRequest) (err error) { // validate deprecated postgres_type field if o.Deprecated_PostgresType != "" { fmt.Fprintf(os.Stderr, "WARNING: \"postgres_type\" is deprecated. Instead, use \"db_type\" to specify a type override.\n") @@ -65,6 +92,11 @@ func (o *Override) Parse() (err error) { o.Nullable = true } + schema := "public" + if req != nil && req.Catalog != nil { + schema = req.Catalog.DefaultSchema + } + // validate option combinations switch { case o.Column != "" && o.DBType != "": @@ -84,7 +116,7 @@ func (o *Override) Parse() (err error) { if o.TableRel, err = pattern.MatchCompile(colParts[0]); err != nil { return err } - if o.TableSchema, err = pattern.MatchCompile("public"); err != nil { + if o.TableSchema, err = pattern.MatchCompile(schema); err != nil { return err } case 3: @@ -116,7 +148,7 @@ func (o *Override) Parse() (err error) { } // validate GoType - parsed, err := o.GoType.Parse() + parsed, err := o.GoType.parse() if err != nil { return err } @@ -126,11 +158,12 @@ func (o *Override) Parse() (err error) { o.GoBasicType = parsed.BasicType // validate GoStructTag - tags, err := o.GoStructTag.Parse() + tags, err := o.GoStructTag.parse() if err != nil { return err } o.GoStructTags = tags + o.ShimOverride = shimOverride(req, o) return nil } diff --git a/internal/codegen/golang/opts/override_test.go b/internal/codegen/golang/opts/override_test.go new file mode 100644 index 0000000000..8405666f36 --- /dev/null +++ b/internal/codegen/golang/opts/override_test.go @@ -0,0 +1,117 @@ +package opts + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestTypeOverrides(t *testing.T) { + for _, test := range []struct { + override Override + pkg string + typeName string + basic bool + }{ + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "github.com/segmentio/ksuid.KSUID"}, + }, + "github.com/segmentio/ksuid", + "ksuid.KSUID", + false, + }, + // TODO: Add test for struct pointers + // + // { + // Override{ + // DBType: "uuid", + // GoType: "github.com/segmentio/*ksuid.KSUID", + // }, + // "github.com/segmentio/ksuid", + // "*ksuid.KSUID", + // false, + // }, + { + Override{ + DBType: "citext", + GoType: GoType{Spec: "string"}, + }, + "", + "string", + true, + }, + { + Override{ + DBType: "timestamp", + GoType: GoType{Spec: "time.Time"}, + }, + "time", + "time.Time", + false, + }, + } { + tt := test + t.Run(tt.override.GoType.Spec, func(t *testing.T) { + if err := tt.override.parse(nil); err != nil { + t.Fatalf("override parsing failed; %s", err) + } + if diff := cmp.Diff(tt.pkg, tt.override.GoImportPath); diff != "" { + t.Errorf("package mismatch;\n%s", diff) + } + if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" { + t.Errorf("type name mismatch;\n%s", diff) + } + if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" { + t.Errorf("basic mismatch;\n%s", diff) + } + }) + } + for _, test := range []struct { + override Override + err string + }{ + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "Pointer"}, + }, + "Package override `go_type` specifier \"Pointer\" is not a Go basic type e.g. 'string'", + }, + { + Override{ + DBType: "uuid", + GoType: GoType{Spec: "untyped rune"}, + }, + "Package override `go_type` specifier \"untyped rune\" is not a Go basic type e.g. 'string'", + }, + } { + tt := test + t.Run(tt.override.GoType.Spec, func(t *testing.T) { + err := tt.override.parse(nil) + if err == nil { + t.Fatalf("expected parse to fail; got nil") + } + if diff := cmp.Diff(tt.err, err.Error()); diff != "" { + t.Errorf("error mismatch;\n%s", diff) + } + }) + } +} + +func FuzzOverride(f *testing.F) { + for _, spec := range []string{ + "string", + "github.com/gofrs/uuid.UUID", + "github.com/segmentio/ksuid.KSUID", + } { + f.Add(spec) + } + f.Fuzz(func(t *testing.T, s string) { + o := Override{ + GoType: GoType{Spec: s}, + } + o.parse(nil) + }) +} diff --git a/internal/codegen/golang/opts/shim.go b/internal/codegen/golang/opts/shim.go new file mode 100644 index 0000000000..500db15280 --- /dev/null +++ b/internal/codegen/golang/opts/shim.go @@ -0,0 +1,77 @@ +package opts + +import ( + "strings" + + "github.com/sqlc-dev/sqlc/internal/plugin" +) + +// The ShimOverride struct exists to bridge the gap between the Override struct +// and the previous Override struct defined in codegen.proto. Eventually these +// shim structs should be removed in favor of using the existing Override and +// GoType structs, but it's easier to provide these shim structs to not change +// the existing, working code. +type ShimOverride struct { + DbType string + Nullable bool + Column string + Table *plugin.Identifier + ColumnName string + Unsigned bool + GoType *ShimGoType +} + +func shimOverride(req *plugin.CodeGenRequest, o *Override) *ShimOverride { + var column string + var table plugin.Identifier + + if o.Column != "" { + colParts := strings.Split(o.Column, ".") + switch len(colParts) { + case 2: + table.Schema = req.Catalog.DefaultSchema + table.Name = colParts[0] + column = colParts[1] + case 3: + table.Schema = colParts[0] + table.Name = colParts[1] + column = colParts[2] + case 4: + table.Catalog = colParts[0] + table.Schema = colParts[1] + table.Name = colParts[2] + column = colParts[3] + } + } + return &ShimOverride{ + DbType: o.DBType, + Nullable: o.Nullable, + Unsigned: o.Unsigned, + Column: o.Column, + ColumnName: column, + Table: &table, + GoType: shimGoType(o), + } +} + +type ShimGoType struct { + ImportPath string + Package string + TypeName string + BasicType bool + StructTags map[string]string +} + +func shimGoType(o *Override) *ShimGoType { + // 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/v1.18.0/reference/config.html#type-overriding + return &ShimGoType{ + ImportPath: o.GoImportPath, + Package: o.GoPackage, + TypeName: o.GoTypeName, + BasicType: o.GoBasicType, + StructTags: o.GoStructTags, + } +} diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index 4b4cf25a0e..5a5f1919ba 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -573,14 +573,14 @@ func postgresType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin if rel.Name == enum.Name && rel.Schema == schema.Name { if notNull { if schema.Name == req.Catalog.DefaultSchema { - return StructName(enum.Name, req.Settings) + return StructName(enum.Name, options) } - return StructName(schema.Name+"_"+enum.Name, req.Settings) + return StructName(schema.Name+"_"+enum.Name, options) } else { if schema.Name == req.Catalog.DefaultSchema { - return "Null" + StructName(enum.Name, req.Settings) + return "Null" + StructName(enum.Name, options) } - return "Null" + StructName(schema.Name+"_"+enum.Name, req.Settings) + return "Null" + StructName(schema.Name+"_"+enum.Name, options) } } } diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index e8c97df372..3d7046d808 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -27,7 +27,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts.Options) []Enum { } e := Enum{ - Name: StructName(enumName, req.Settings), + Name: StructName(enumName, options), Comment: enum.Comment, NameTags: map[string]string{}, ValidTags: map[string]string{}, @@ -44,7 +44,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts.Options) []Enum { value = fmt.Sprintf("value_%d", i) } e.Constants = append(e.Constants, Constant{ - Name: StructName(enumName+"_"+value, req.Settings), + Name: StructName(enumName+"_"+value, options), Value: v, Type: e.Name, }) @@ -81,7 +81,7 @@ func buildStructs(req *plugin.CodeGenRequest, options *opts.Options) []Struct { } s := Struct{ Table: &plugin.Identifier{Schema: schema.Name, Name: table.Rel.Name}, - Name: StructName(structName, req.Settings), + Name: StructName(structName, options), Comment: table.Comment, } for _, column := range table.Columns { @@ -92,9 +92,9 @@ func buildStructs(req *plugin.CodeGenRequest, options *opts.Options) []Struct { if options.EmitJsonTags { tags["json"] = JSONTagName(column.Name, options) } - addExtraGoStructTags(tags, req, column) + addExtraGoStructTags(tags, req, options, column) s.Fields = append(s.Fields, Field{ - Name: StructName(column.Name, req.Settings), + Name: StructName(column.Name, options), Type: goType(req, options, column), Tags: tags, Comment: column.Comment, @@ -268,7 +268,7 @@ func buildQueries(req *plugin.CodeGenRequest, options *opts.Options, structs []S same := true for i, f := range s.Fields { c := query.Columns[i] - sameName := f.Name == StructName(columnName(c, i), req.Settings) + sameName := f.Name == StructName(columnName(c, i), options) sameType := f.Type == goType(req, options, c) sameTable := sdk.SameTableName(c.Table, s.Table, req.Catalog.DefaultSchema) if !sameName || !sameType || !sameTable { @@ -348,7 +348,7 @@ func columnsToStruct(req *plugin.CodeGenRequest, options *opts.Options, name str tagName = SetCaseStyle(colName, "snake") } - fieldName := StructName(colName, req.Settings) + fieldName := StructName(colName, options) baseFieldName := fieldName // Track suffixes by the ID of the column, so that columns referring to the same numbered parameter can be // reused. @@ -370,7 +370,7 @@ func columnsToStruct(req *plugin.CodeGenRequest, options *opts.Options, name str if options.EmitJsonTags { tags["json"] = JSONTagName(tagName, options) } - addExtraGoStructTags(tags, req, c.Column) + addExtraGoStructTags(tags, req, options, c.Column) f := Field{ Name: fieldName, DBName: colName, diff --git a/internal/codegen/golang/struct.go b/internal/codegen/golang/struct.go index 31904205e1..322dd71bf6 100644 --- a/internal/codegen/golang/struct.go +++ b/internal/codegen/golang/struct.go @@ -5,6 +5,7 @@ import ( "unicode" "unicode/utf8" + "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" "github.com/sqlc-dev/sqlc/internal/plugin" ) @@ -15,8 +16,8 @@ type Struct struct { Comment string } -func StructName(name string, settings *plugin.Settings) string { - if rename := settings.Rename[name]; rename != "" { +func StructName(name string, options *opts.Options) string { + if rename := options.Rename[name]; rename != "" { return rename } out := "" diff --git a/internal/codegen/sdk/sdk.go b/internal/codegen/sdk/sdk.go index 415cbaaec5..53e3fc6a9f 100644 --- a/internal/codegen/sdk/sdk.go +++ b/internal/codegen/sdk/sdk.go @@ -21,32 +21,6 @@ func MatchString(pat, target string) bool { 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 SameTableName(tableID, f *plugin.Identifier, defaultSchema string) bool { if tableID == nil { return false diff --git a/internal/config/config.go b/internal/config/config.go index ec68c187a4..e11f40de48 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -7,6 +7,8 @@ import ( "io" "gopkg.in/yaml.v3" + + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) type versionSetting struct { @@ -55,12 +57,13 @@ const ( ) type Config struct { - Version string `json:"version" yaml:"version"` - Cloud Cloud `json:"cloud" yaml:"cloud"` - SQL []SQL `json:"sql" yaml:"sql"` - Overrides Overrides `json:"overrides,omitempty" yaml:"overrides"` - Plugins []Plugin `json:"plugins" yaml:"plugins"` - Rules []Rule `json:"rules" yaml:"rules"` + Version string `json:"version" yaml:"version"` + Cloud Cloud `json:"cloud" yaml:"cloud"` + SQL []SQL `json:"sql" yaml:"sql"` + Overrides Overrides `json:"overrides,omitempty" yaml:"overrides"` + Plugins []Plugin `json:"plugins" yaml:"plugins"` + Rules []Rule `json:"rules" yaml:"rules"` + Options map[string]yaml.Node `json:"options" yaml:"options"` } type Database struct { @@ -94,12 +97,7 @@ type Rule struct { } type Overrides struct { - Go *GoOverrides `json:"go,omitempty" yaml:"go"` -} - -type GoOverrides struct { - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` + Go *golang.GlobalOptions `json:"go,omitempty" yaml:"go"` } type SQL struct { @@ -128,42 +126,8 @@ type Codegen struct { } type SQLGen struct { - Go *SQLGo `json:"go,omitempty" yaml:"go"` - JSON *SQLJSON `json:"json,omitempty" yaml:"json"` -} - -type SQLGo struct { - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` - EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` - EmitExportedQueries bool `json:"emit_exported_queries" yaml:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` - EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument,omitempty" yaml:"emit_methods_with_db_argument"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` - JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` - Package string `json:"package" yaml:"package"` - Out string `json:"out" yaml:"out"` - Overrides []Override `json:"overrides,omitempty" yaml:"overrides"` - Rename map[string]string `json:"rename,omitempty" yaml:"rename"` - SQLPackage string `json:"sql_package" yaml:"sql_package"` - SQLDriver string `json:"sql_driver" yaml:"sql_driver"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` - OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` - OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` - OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` - InflectionExcludeTableNames []string `json:"inflection_exclude_table_names,omitempty" yaml:"inflection_exclude_table_names"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` - BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` + Go *golang.Options `json:"go,omitempty" yaml:"go"` + JSON *SQLJSON `json:"json,omitempty" yaml:"json"` } type SQLJSON struct { @@ -241,12 +205,10 @@ func ParseConfig(rd io.Reader) (Config, error) { } type CombinedSettings struct { - Global Config - Package SQL - Go SQLGo - JSON SQLJSON - Rename map[string]string - Overrides []Override + Global Config + Package SQL + Go golang.Options + JSON SQLJSON // TODO: Combine these into a more usable type Codegen Codegen @@ -256,20 +218,9 @@ func Combine(conf Config, pkg SQL) CombinedSettings { cs := CombinedSettings{ Global: conf, Package: pkg, - Rename: map[string]string{}, - } - if conf.Overrides.Go != nil { - for k, v := range conf.Overrides.Go.Rename { - cs.Rename[k] = v - } - cs.Overrides = append(cs.Overrides, conf.Overrides.Go.Overrides...) } if pkg.Gen.Go != nil { cs.Go = *pkg.Gen.Go - for k, v := range pkg.Gen.Go.Rename { - cs.Rename[k] = v - } - cs.Overrides = append(cs.Overrides, pkg.Gen.Go.Overrides...) } if pkg.Gen.JSON != nil { cs.JSON = *pkg.Gen.JSON diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 240a4b4e1c..57211d674c 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -89,113 +89,3 @@ func TestInvalidConfig(t *testing.T) { t.Errorf("expected err; got nil") } } - -func TestTypeOverrides(t *testing.T) { - for _, test := range []struct { - override Override - pkg string - typeName string - basic bool - }{ - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "github.com/segmentio/ksuid.KSUID"}, - }, - "github.com/segmentio/ksuid", - "ksuid.KSUID", - false, - }, - // TODO: Add test for struct pointers - // - // { - // Override{ - // DBType: "uuid", - // GoType: "github.com/segmentio/*ksuid.KSUID", - // }, - // "github.com/segmentio/ksuid", - // "*ksuid.KSUID", - // false, - // }, - { - Override{ - DBType: "citext", - GoType: GoType{Spec: "string"}, - }, - "", - "string", - true, - }, - { - Override{ - DBType: "timestamp", - GoType: GoType{Spec: "time.Time"}, - }, - "time", - "time.Time", - false, - }, - } { - tt := test - t.Run(tt.override.GoType.Spec, func(t *testing.T) { - if err := tt.override.Parse(); err != nil { - t.Fatalf("override parsing failed; %s", err) - } - if diff := cmp.Diff(tt.pkg, tt.override.GoImportPath); diff != "" { - t.Errorf("package mismatch;\n%s", diff) - } - if diff := cmp.Diff(tt.typeName, tt.override.GoTypeName); diff != "" { - t.Errorf("type name mismatch;\n%s", diff) - } - if diff := cmp.Diff(tt.basic, tt.override.GoBasicType); diff != "" { - t.Errorf("basic mismatch;\n%s", diff) - } - }) - } - for _, test := range []struct { - override Override - err string - }{ - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "Pointer"}, - }, - "Package override `go_type` specifier \"Pointer\" is not a Go basic type e.g. 'string'", - }, - { - Override{ - DBType: "uuid", - GoType: GoType{Spec: "untyped rune"}, - }, - "Package override `go_type` specifier \"untyped rune\" is not a Go basic type e.g. 'string'", - }, - } { - tt := test - t.Run(tt.override.GoType.Spec, func(t *testing.T) { - err := tt.override.Parse() - if err == nil { - t.Fatalf("expected parse to fail; got nil") - } - if diff := cmp.Diff(tt.err, err.Error()); diff != "" { - t.Errorf("error mismatch;\n%s", diff) - } - }) - } -} - -func FuzzOverride(f *testing.F) { - for _, spec := range []string{ - "string", - "github.com/gofrs/uuid.UUID", - "github.com/segmentio/ksuid.KSUID", - } { - f.Add(spec) - } - f.Fuzz(func(t *testing.T, s string) { - o := Override{ - GoType: GoType{Spec: s}, - } - o.Parse() - }) -} diff --git a/internal/config/v_one.go b/internal/config/v_one.go index d4d329660f..be3c3a9a33 100644 --- a/internal/config/v_one.go +++ b/internal/config/v_one.go @@ -6,55 +6,57 @@ import ( "path/filepath" yaml "gopkg.in/yaml.v3" + + golang "github.com/sqlc-dev/sqlc/internal/codegen/golang/opts" ) type V1GenerateSettings struct { Version string `json:"version" yaml:"version"` Cloud Cloud `json:"cloud" yaml:"cloud"` Packages []v1PackageSettings `json:"packages" yaml:"packages"` - Overrides []Override `json:"overrides,omitempty" yaml:"overrides,omitempty"` + Overrides []golang.Override `json:"overrides,omitempty" yaml:"overrides,omitempty"` Rename map[string]string `json:"rename,omitempty" yaml:"rename,omitempty"` Rules []Rule `json:"rules" yaml:"rules"` } type v1PackageSettings struct { - Name string `json:"name" yaml:"name"` - Engine Engine `json:"engine,omitempty" yaml:"engine"` - Database *Database `json:"database,omitempty" yaml:"database"` - Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` - Path string `json:"path" yaml:"path"` - Schema Paths `json:"schema" yaml:"schema"` - Queries Paths `json:"queries" yaml:"queries"` - EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` - EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` - JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` - EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` - EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` - EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` - EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` - EmitExportedQueries bool `json:"emit_exported_queries,omitempty" yaml:"emit_exported_queries"` - EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` - EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` - EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument" yaml:"emit_methods_with_db_argument"` - EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` - EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` - EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` - JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` - SQLPackage string `json:"sql_package" yaml:"sql_package"` - SQLDriver string `json:"sql_driver" yaml:"sql_driver"` - Overrides []Override `json:"overrides" yaml:"overrides"` - OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` - OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` - OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` - OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` - OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` - OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` - StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` - StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` - QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` - OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` - Rules []string `json:"rules" yaml:"rules"` - BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` + Name string `json:"name" yaml:"name"` + Engine Engine `json:"engine,omitempty" yaml:"engine"` + Database *Database `json:"database,omitempty" yaml:"database"` + Analyzer Analyzer `json:"analyzer" yaml:"analyzer"` + Path string `json:"path" yaml:"path"` + Schema Paths `json:"schema" yaml:"schema"` + Queries Paths `json:"queries" yaml:"queries"` + EmitInterface bool `json:"emit_interface" yaml:"emit_interface"` + EmitJSONTags bool `json:"emit_json_tags" yaml:"emit_json_tags"` + JsonTagsIDUppercase bool `json:"json_tags_id_uppercase" yaml:"json_tags_id_uppercase"` + EmitDBTags bool `json:"emit_db_tags" yaml:"emit_db_tags"` + EmitPreparedQueries bool `json:"emit_prepared_queries" yaml:"emit_prepared_queries"` + EmitExactTableNames bool `json:"emit_exact_table_names,omitempty" yaml:"emit_exact_table_names"` + EmitEmptySlices bool `json:"emit_empty_slices,omitempty" yaml:"emit_empty_slices"` + EmitExportedQueries bool `json:"emit_exported_queries,omitempty" yaml:"emit_exported_queries"` + EmitResultStructPointers bool `json:"emit_result_struct_pointers" yaml:"emit_result_struct_pointers"` + EmitParamsStructPointers bool `json:"emit_params_struct_pointers" yaml:"emit_params_struct_pointers"` + EmitMethodsWithDBArgument bool `json:"emit_methods_with_db_argument" yaml:"emit_methods_with_db_argument"` + EmitPointersForNullTypes bool `json:"emit_pointers_for_null_types" yaml:"emit_pointers_for_null_types"` + EmitEnumValidMethod bool `json:"emit_enum_valid_method,omitempty" yaml:"emit_enum_valid_method"` + EmitAllEnumValues bool `json:"emit_all_enum_values,omitempty" yaml:"emit_all_enum_values"` + JSONTagsCaseStyle string `json:"json_tags_case_style,omitempty" yaml:"json_tags_case_style"` + SQLPackage string `json:"sql_package" yaml:"sql_package"` + SQLDriver string `json:"sql_driver" yaml:"sql_driver"` + Overrides []golang.Override `json:"overrides" yaml:"overrides"` + OutputBatchFileName string `json:"output_batch_file_name,omitempty" yaml:"output_batch_file_name"` + OutputDBFileName string `json:"output_db_file_name,omitempty" yaml:"output_db_file_name"` + OutputModelsFileName string `json:"output_models_file_name,omitempty" yaml:"output_models_file_name"` + OutputQuerierFileName string `json:"output_querier_file_name,omitempty" yaml:"output_querier_file_name"` + OutputCopyFromFileName string `json:"output_copyfrom_file_name,omitempty" yaml:"output_copyfrom_file_name"` + OutputFilesSuffix string `json:"output_files_suffix,omitempty" yaml:"output_files_suffix"` + StrictFunctionChecks bool `json:"strict_function_checks" yaml:"strict_function_checks"` + StrictOrderBy *bool `json:"strict_order_by" yaml:"strict_order_by"` + QueryParameterLimit *int32 `json:"query_parameter_limit,omitempty" yaml:"query_parameter_limit"` + OmitUnusedStructs bool `json:"omit_unused_structs,omitempty" yaml:"omit_unused_structs"` + Rules []string `json:"rules" yaml:"rules"` + BuildTags string `json:"build_tags,omitempty" yaml:"build_tags"` } func v1ParseConfig(rd io.Reader) (Config, error) { @@ -77,11 +79,6 @@ func v1ParseConfig(rd io.Reader) (Config, error) { if err := settings.ValidateGlobalOverrides(); err != nil { return config, err } - for i := range settings.Overrides { - if err := settings.Overrides[i].Parse(); err != nil { - return config, err - } - } for j := range settings.Packages { if settings.Packages[j].Path == "" { return config, ErrNoPackagePath @@ -96,18 +93,13 @@ func v1ParseConfig(rd io.Reader) (Config, error) { *settings.Packages[j].QueryParameterLimit = 1 } - for i := range settings.Packages[j].Overrides { - if err := settings.Packages[j].Overrides[i].Parse(); err != nil { - return config, err - } - } if settings.Packages[j].Name == "" { settings.Packages[j].Name = filepath.Base(settings.Packages[j].Path) } + if settings.Packages[j].Engine == "" { settings.Packages[j].Engine = EnginePostgreSQL } - } return settings.Translate(), nil @@ -151,32 +143,32 @@ func (c *V1GenerateSettings) Translate() Config { Rules: pkg.Rules, Analyzer: pkg.Analyzer, Gen: SQLGen{ - Go: &SQLGo{ + Go: &golang.Options{ EmitInterface: pkg.EmitInterface, - EmitJSONTags: pkg.EmitJSONTags, - JsonTagsIDUppercase: pkg.JsonTagsIDUppercase, - EmitDBTags: pkg.EmitDBTags, + EmitJsonTags: pkg.EmitJSONTags, + JsonTagsIdUppercase: pkg.JsonTagsIDUppercase, + EmitDbTags: pkg.EmitDBTags, EmitPreparedQueries: pkg.EmitPreparedQueries, EmitExactTableNames: pkg.EmitExactTableNames, EmitEmptySlices: pkg.EmitEmptySlices, EmitExportedQueries: pkg.EmitExportedQueries, EmitResultStructPointers: pkg.EmitResultStructPointers, EmitParamsStructPointers: pkg.EmitParamsStructPointers, - EmitMethodsWithDBArgument: pkg.EmitMethodsWithDBArgument, + EmitMethodsWithDbArgument: pkg.EmitMethodsWithDBArgument, EmitPointersForNullTypes: pkg.EmitPointersForNullTypes, EmitEnumValidMethod: pkg.EmitEnumValidMethod, EmitAllEnumValues: pkg.EmitAllEnumValues, Package: pkg.Name, Out: pkg.Path, - SQLPackage: pkg.SQLPackage, - SQLDriver: pkg.SQLDriver, + SqlPackage: pkg.SQLPackage, + SqlDriver: pkg.SQLDriver, Overrides: pkg.Overrides, - JSONTagsCaseStyle: pkg.JSONTagsCaseStyle, + JsonTagsCaseStyle: pkg.JSONTagsCaseStyle, OutputBatchFileName: pkg.OutputBatchFileName, - OutputDBFileName: pkg.OutputDBFileName, + OutputDbFileName: pkg.OutputDBFileName, OutputModelsFileName: pkg.OutputModelsFileName, OutputQuerierFileName: pkg.OutputQuerierFileName, - OutputCopyFromFileName: pkg.OutputCopyFromFileName, + OutputCopyfromFileName: pkg.OutputCopyFromFileName, OutputFilesSuffix: pkg.OutputFilesSuffix, QueryParameterLimit: pkg.QueryParameterLimit, OmitUnusedStructs: pkg.OmitUnusedStructs, @@ -189,7 +181,7 @@ func (c *V1GenerateSettings) Translate() Config { } if len(c.Overrides) > 0 || len(c.Rename) > 0 { - conf.Overrides.Go = &GoOverrides{ + conf.Overrides.Go = &golang.GlobalOptions{ Overrides: c.Overrides, Rename: c.Rename, } diff --git a/internal/config/v_two.go b/internal/config/v_two.go index 0fca849864..30a8f58371 100644 --- a/internal/config/v_two.go +++ b/internal/config/v_two.go @@ -27,13 +27,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) { if err := conf.validateGlobalOverrides(); err != nil { return conf, err } - if conf.Overrides.Go != nil { - for i := range conf.Overrides.Go.Overrides { - if err := conf.Overrides.Go.Overrides[i].Parse(); err != nil { - return conf, err - } - } - } // TODO: Store built-in plugins somewhere else builtins := map[string]struct{}{ "go": {}, @@ -83,15 +76,6 @@ func v2ParseConfig(rd io.Reader) (Config, error) { conf.SQL[j].Gen.Go.QueryParameterLimit = new(int32) *conf.SQL[j].Gen.Go.QueryParameterLimit = 1 } - - for i := range conf.SQL[j].Gen.Go.Overrides { - if err := conf.SQL[j].Gen.Go.Overrides[i].Parse(); err != nil { - return conf, err - } - } - for k, v := range conf.SQL[j].Gen.Go.Rename { - conf.SQL[j].Gen.Go.Rename[k] = v - } } if conf.SQL[j].Gen.JSON != nil { if conf.SQL[j].Gen.JSON.Out == "" { diff --git a/internal/endtoend/testdata/codegen_json/gen/codegen.json b/internal/endtoend/testdata/codegen_json/gen/codegen.json index 3b23ef192e..b4fbf9ba76 100644 --- a/internal/endtoend/testdata/codegen_json/gen/codegen.json +++ b/internal/endtoend/testdata/codegen_json/gen/codegen.json @@ -8,8 +8,6 @@ "queries": [ "postgresql/query.sql" ], - "rename": {}, - "overrides": [], "codegen": { "out": "", "plugin": "", @@ -65366,5 +65364,6 @@ } ], "sqlc_version": "v1.23.0", - "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=" + "plugin_options": "eyJvdXQiOiJnZW4iLCJpbmRlbnQiOiIgICIsImZpbGVuYW1lIjoiY29kZWdlbi5qc29uIn0=", + "global_options": "" } diff --git a/internal/endtoend/testdata/overrides_config/query.sql b/internal/endtoend/testdata/overrides_config/query.sql new file mode 100644 index 0000000000..e0ac49d1ec --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/query.sql @@ -0,0 +1 @@ +SELECT 1; diff --git a/internal/endtoend/testdata/overrides_config/schema.sql b/internal/endtoend/testdata/overrides_config/schema.sql new file mode 100644 index 0000000000..03d90e1cec --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE overrides ( + one text NOT NULL, + two bigint NOT NULL, + three text[] NOT NULL, + four bytea NOT NULL, + five text[] +); diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go new file mode 100644 index 0000000000..4485929884 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.23.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go new file mode 100644 index 0000000000..080983e159 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.23.0 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml new file mode 100644 index 0000000000..335759cfd2 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global/sqlc.yaml @@ -0,0 +1,19 @@ +version: "2" +overrides: + go: + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go new file mode 100644 index 0000000000..4485929884 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.23.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go new file mode 100644 index 0000000000..080983e159 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.23.0 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml new file mode 100644 index 0000000000..62ef7e7772 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/global_and_queryset/sqlc.yaml @@ -0,0 +1,26 @@ +version: "2" +overrides: + go: + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" + rename: + one: "ONE" + overrides: + - column: "overrides.three" + go_type: + import: "invalid/import" + type: "ShouldNotSeeThis" diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go new file mode 100644 index 0000000000..4485929884 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.23.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go new file mode 100644 index 0000000000..080983e159 --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/db/models.go @@ -0,0 +1,17 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.23.0 + +package db + +import ( + "github.com/sqlc-dev/sqlc-testdata/pkg" +) + +type Override struct { + ONE pkg.CustomType + Two int64 + Three pkg.CustomType + Four []byte + Five []pkg.CustomType +} diff --git a/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml new file mode 100644 index 0000000000..7847f6d08d --- /dev/null +++ b/internal/endtoend/testdata/overrides_config/v2/yaml/queryset/sqlc.yaml @@ -0,0 +1,17 @@ +version: "2" +sql: +- schema: "../../../schema.sql" + queries: "../../../query.sql" + engine: "postgresql" + gen: + go: + out: "db" + rename: + one: "ONE" + overrides: + - db_type: "text" + go_type: "github.com/sqlc-dev/sqlc-testdata/pkg.CustomType" + - column: "overrides.three" + go_type: + import: "github.com/sqlc-dev/sqlc-testdata/pkg" + type: "CustomType" diff --git a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt index cb6fb84aec..c6891c182b 100644 --- a/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt +++ b/internal/endtoend/testdata/overrides_go_struct_tags/invalid_tags/stderr.txt @@ -1 +1,2 @@ -error parsing sqlc.json: bad syntax for struct tag pair +# package override +error generating code: bad syntax for struct tag pair diff --git a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json index cd1be9de2b..beb1f4ab45 100644 --- a/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json +++ b/internal/endtoend/testdata/process_plugin_sqlc_gen_json/gen/codegen.json @@ -8,8 +8,6 @@ "queries": [ "query.sql" ], - "rename": {}, - "overrides": [], "codegen": { "out": "gen", "plugin": "jsonb", @@ -65368,5 +65366,6 @@ } ], "sqlc_version": "v1.23.0", - "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=" + "plugin_options": "eyJmaWxlbmFtZSI6ImNvZGVnZW4uanNvbiIsImluZGVudCI6IiAgIn0=", + "global_options": "" } diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 7b3347c6e1..027559a216 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -75,211 +75,22 @@ func (x *File) GetContents() []byte { return nil } -type Override struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` - CodeType string `protobuf:"bytes,1,opt,name=code_type,proto3" json:"code_type,omitempty"` - // name of the type to use, e.g. `text` - DbType string `protobuf:"bytes,3,opt,name=db_type,proto3" json:"db_type,omitempty"` - // 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"` - GoType *ParsedGoType `protobuf:"bytes,10,opt,name=go_type,json=goType,proto3" json:"go_type,omitempty"` - // True if the override should apply to a unsigned database type - Unsigned bool `protobuf:"varint,11,opt,name=unsigned,proto3" json:"unsigned,omitempty"` -} - -func (x *Override) Reset() { - *x = Override{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Override) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Override) ProtoMessage() {} - -func (x *Override) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[1] - 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 Override.ProtoReflect.Descriptor instead. -func (*Override) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{1} -} - -func (x *Override) GetCodeType() string { - if x != nil { - return x.CodeType - } - return "" -} - -func (x *Override) GetDbType() string { - if x != nil { - return x.DbType - } - return "" -} - -func (x *Override) GetNullable() bool { - if x != nil { - return x.Nullable - } - return false -} - -func (x *Override) GetColumn() string { - if x != nil { - return x.Column - } - return "" -} - -func (x *Override) GetTable() *Identifier { - if x != nil { - return x.Table - } - return nil -} - -func (x *Override) GetColumnName() string { - if x != nil { - return x.ColumnName - } - return "" -} - -func (x *Override) GetGoType() *ParsedGoType { - if x != nil { - return x.GoType - } - return nil -} - -func (x *Override) GetUnsigned() bool { - if x != nil { - return x.Unsigned - } - return false -} - -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"` - StructTags map[string]string `protobuf:"bytes,5,rep,name=struct_tags,json=structTags,proto3" json:"struct_tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *ParsedGoType) Reset() { - *x = ParsedGoType{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[2] - 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[2] - 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{2} -} - -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 -} - -func (x *ParsedGoType) GetStructTags() map[string]string { - if x != nil { - return x.StructTags - } - return nil -} - type Settings struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` - Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` - Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` - Rename map[string]string `protobuf:"bytes,5,rep,name=rename,proto3" json:"rename,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Overrides []*Override `protobuf:"bytes,6,rep,name=overrides,proto3" json:"overrides,omitempty"` - Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Engine string `protobuf:"bytes,2,opt,name=engine,proto3" json:"engine,omitempty"` + Schema []string `protobuf:"bytes,3,rep,name=schema,proto3" json:"schema,omitempty"` + Queries []string `protobuf:"bytes,4,rep,name=queries,proto3" json:"queries,omitempty"` + Codegen *Codegen `protobuf:"bytes,12,opt,name=codegen,proto3" json:"codegen,omitempty"` } func (x *Settings) Reset() { *x = Settings{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[3] + mi := &file_plugin_codegen_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -292,7 +103,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[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -305,7 +116,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{1} } func (x *Settings) GetVersion() string { @@ -336,20 +147,6 @@ func (x *Settings) GetQueries() []string { return nil } -func (x *Settings) GetRename() map[string]string { - if x != nil { - return x.Rename - } - return nil -} - -func (x *Settings) GetOverrides() []*Override { - if x != nil { - return x.Overrides - } - return nil -} - func (x *Settings) GetCodegen() *Codegen { if x != nil { return x.Codegen @@ -373,7 +170,7 @@ type Codegen struct { func (x *Codegen) Reset() { *x = Codegen{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[4] + mi := &file_plugin_codegen_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -386,7 +183,7 @@ func (x *Codegen) String() string { func (*Codegen) ProtoMessage() {} func (x *Codegen) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[4] + mi := &file_plugin_codegen_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -399,7 +196,7 @@ func (x *Codegen) ProtoReflect() protoreflect.Message { // Deprecated: Use Codegen.ProtoReflect.Descriptor instead. func (*Codegen) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4} + return file_plugin_codegen_proto_rawDescGZIP(), []int{2} } func (x *Codegen) GetOut() string { @@ -458,7 +255,7 @@ type Catalog struct { func (x *Catalog) Reset() { *x = Catalog{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -471,7 +268,7 @@ func (x *Catalog) String() string { func (*Catalog) ProtoMessage() {} func (x *Catalog) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[5] + mi := &file_plugin_codegen_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -484,7 +281,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{5} + return file_plugin_codegen_proto_rawDescGZIP(), []int{3} } func (x *Catalog) GetComment() string { @@ -530,7 +327,7 @@ type Schema struct { func (x *Schema) Reset() { *x = Schema{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -543,7 +340,7 @@ func (x *Schema) String() string { func (*Schema) ProtoMessage() {} func (x *Schema) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[6] + mi := &file_plugin_codegen_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -556,7 +353,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{6} + return file_plugin_codegen_proto_rawDescGZIP(), []int{4} } func (x *Schema) GetComment() string { @@ -606,7 +403,7 @@ type CompositeType struct { func (x *CompositeType) Reset() { *x = CompositeType{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -619,7 +416,7 @@ func (x *CompositeType) String() string { func (*CompositeType) ProtoMessage() {} func (x *CompositeType) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[7] + mi := &file_plugin_codegen_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -632,7 +429,7 @@ func (x *CompositeType) ProtoReflect() protoreflect.Message { // Deprecated: Use CompositeType.ProtoReflect.Descriptor instead. func (*CompositeType) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{7} + return file_plugin_codegen_proto_rawDescGZIP(), []int{5} } func (x *CompositeType) GetName() string { @@ -662,7 +459,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[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -675,7 +472,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[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -688,7 +485,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{6} } func (x *Enum) GetName() string { @@ -725,7 +522,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[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -738,7 +535,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[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -751,7 +548,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{7} } func (x *Table) GetRel() *Identifier { @@ -788,7 +585,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[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -801,7 +598,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[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -814,7 +611,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{8} } func (x *Identifier) GetCatalog() string { @@ -865,7 +662,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[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -878,7 +675,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[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -891,7 +688,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{9} } func (x *Column) GetName() string { @@ -1024,7 +821,7 @@ type Query struct { func (x *Query) Reset() { *x = Query{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[12] + mi := &file_plugin_codegen_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1037,7 +834,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[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1050,7 +847,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{10} } func (x *Query) GetText() string { @@ -1121,7 +918,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[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1134,7 +931,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[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1147,7 +944,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{11} } func (x *Parameter) GetNumber() int32 { @@ -1174,12 +971,13 @@ type CodeGenRequest struct { Queries []*Query `protobuf:"bytes,3,rep,name=queries,proto3" json:"queries,omitempty"` SqlcVersion string `protobuf:"bytes,4,opt,name=sqlc_version,proto3" json:"sqlc_version,omitempty"` PluginOptions []byte `protobuf:"bytes,5,opt,name=plugin_options,proto3" json:"plugin_options,omitempty"` + GlobalOptions []byte `protobuf:"bytes,6,opt,name=global_options,proto3" json:"global_options,omitempty"` } func (x *CodeGenRequest) Reset() { *x = CodeGenRequest{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[14] + mi := &file_plugin_codegen_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1192,7 +990,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[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1205,7 +1003,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{12} } func (x *CodeGenRequest) GetSettings() *Settings { @@ -1243,6 +1041,13 @@ func (x *CodeGenRequest) GetPluginOptions() []byte { return nil } +func (x *CodeGenRequest) GetGlobalOptions() []byte { + if x != nil { + return x.GlobalOptions + } + return nil +} + type CodeGenResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1254,7 +1059,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[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1267,7 +1072,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[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1280,7 +1085,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{13} } func (x *CodeGenResponse) GetFiles() []*File { @@ -1301,7 +1106,7 @@ type Codegen_Process struct { func (x *Codegen_Process) Reset() { *x = Codegen_Process{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[18] + mi := &file_plugin_codegen_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1314,7 +1119,7 @@ func (x *Codegen_Process) String() string { func (*Codegen_Process) ProtoMessage() {} func (x *Codegen_Process) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[18] + mi := &file_plugin_codegen_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1327,7 +1132,7 @@ func (x *Codegen_Process) ProtoReflect() protoreflect.Message { // Deprecated: Use Codegen_Process.ProtoReflect.Descriptor instead. func (*Codegen_Process) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4, 0} + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 0} } func (x *Codegen_Process) GetCmd() string { @@ -1349,7 +1154,7 @@ type Codegen_WASM struct { func (x *Codegen_WASM) Reset() { *x = Codegen_WASM{} if protoimpl.UnsafeEnabled { - mi := &file_plugin_codegen_proto_msgTypes[19] + mi := &file_plugin_codegen_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1362,7 +1167,7 @@ func (x *Codegen_WASM) String() string { func (*Codegen_WASM) ProtoMessage() {} func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { - mi := &file_plugin_codegen_proto_msgTypes[19] + mi := &file_plugin_codegen_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1375,7 +1180,7 @@ func (x *Codegen_WASM) ProtoReflect() protoreflect.Message { // Deprecated: Use Codegen_WASM.ProtoReflect.Descriptor instead. func (*Codegen_WASM) Descriptor() ([]byte, []int) { - return file_plugin_codegen_proto_rawDescGZIP(), []int{4, 1} + return file_plugin_codegen_proto_rawDescGZIP(), []int{2, 1} } func (x *Codegen_WASM) GetUrl() string { @@ -1400,202 +1205,161 @@ 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, 0x93, 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, - 0x28, 0x09, 0x52, 0x07, 0x64, 0x62, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, - 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6e, - 0x75, 0x6c, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, - 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, - 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x07, 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, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, - 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x63, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 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, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4a, 0x04, 0x08, 0x09, 0x10, 0x0a, 0x22, 0x8b, 0x02, 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, 0x12, 0x45, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x5f, 0x74, - 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x70, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x47, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x2e, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, - 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x3d, 0x0a, 0x0f, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x54, 0x61, 0x67, 0x73, 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, 0xd2, 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, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, 0x65, 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, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, 0x08, - 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, 0x22, - 0x8b, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, - 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, - 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, - 0x76, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x70, 0x72, 0x6f, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x57, 0x41, 0x53, 0x4d, 0x52, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x1a, 0x1b, - 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x1a, 0x30, 0x0a, 0x04, 0x57, - 0x41, 0x53, 0x4d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 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, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xb7, 0x01, 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, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, + 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x52, 0x07, 0x63, 0x6f, 0x64, 0x65, 0x67, + 0x65, 0x6e, 0x4a, 0x04, 0x08, 0x05, 0x10, 0x06, 0x4a, 0x04, 0x08, 0x08, 0x10, 0x09, 0x4a, 0x04, + 0x08, 0x09, 0x10, 0x0a, 0x4a, 0x04, 0x08, 0x0a, 0x10, 0x0b, 0x4a, 0x04, 0x08, 0x0b, 0x10, 0x0c, + 0x22, 0x8b, 0x02, 0x0a, 0x07, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, + 0x6e, 0x76, 0x12, 0x31, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x70, 0x72, + 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x6f, 0x64, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x57, 0x41, 0x53, 0x4d, 0x52, 0x04, 0x77, 0x61, 0x73, 0x6d, 0x1a, + 0x1b, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x1a, 0x30, 0x0a, 0x04, + 0x57, 0x41, 0x53, 0x4d, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 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, 0x8e, 0x04, + 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, - 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, 0x8e, 0x04, 0x0a, - 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, - 0x6f, 0x74, 0x5f, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6e, - 0x6f, 0x74, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x72, - 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, - 0x66, 0x75, 0x6e, 0x63, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0a, 0x69, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, - 0x65, 0x12, 0x28, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x26, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6c, 0x75, - 0x67, 0x69, 0x6e, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, 0x5f, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x53, - 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, 0x65, - 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 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, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, 0x0a, - 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, 0x1d, - 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 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, 0xde, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, 0x74, - 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, 0x0a, - 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, 0x71, - 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x71, - 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0x35, 0x0a, 0x0f, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, - 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, - 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0xca, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x73, 0x71, 0x6c, 0x63, + 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, + 0x53, 0x71, 0x6c, 0x63, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x65, 0x6d, 0x62, + 0x65, 0x64, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x0e, 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, 0x0a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x23, + 0x0a, 0x0d, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x75, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x61, 0x72, 0x72, 0x61, 0x79, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x72, 0x72, 0x61, 0x79, 0x44, 0x69, 0x6d, 0x73, 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, 0x86, 0x02, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x43, 0x61, + 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x27, + 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x07, + 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x71, 0x6c, 0x63, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, + 0x71, 0x6c, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x70, + 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x6f, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x67, 0x6c, 0x6f, + 0x62, 0x61, 0x6c, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x35, 0x0a, 0x0f, 0x43, + 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, + 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, + 0x65, 0x73, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x42, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x71, 0x6c, + 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x71, 0x6c, 0x63, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, + 0xaa, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0xca, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, + 0x69, 0x6e, 0xe2, 0x02, 0x12, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1610,60 +1374,51 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { return file_plugin_codegen_proto_rawDescData } -var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_plugin_codegen_proto_goTypes = []interface{}{ (*File)(nil), // 0: plugin.File - (*Override)(nil), // 1: plugin.Override - (*ParsedGoType)(nil), // 2: plugin.ParsedGoType - (*Settings)(nil), // 3: plugin.Settings - (*Codegen)(nil), // 4: plugin.Codegen - (*Catalog)(nil), // 5: plugin.Catalog - (*Schema)(nil), // 6: plugin.Schema - (*CompositeType)(nil), // 7: plugin.CompositeType - (*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.ParsedGoType.StructTagsEntry - nil, // 17: plugin.Settings.RenameEntry - (*Codegen_Process)(nil), // 18: plugin.Codegen.Process - (*Codegen_WASM)(nil), // 19: plugin.Codegen.WASM + (*Settings)(nil), // 1: plugin.Settings + (*Codegen)(nil), // 2: plugin.Codegen + (*Catalog)(nil), // 3: plugin.Catalog + (*Schema)(nil), // 4: plugin.Schema + (*CompositeType)(nil), // 5: plugin.CompositeType + (*Enum)(nil), // 6: plugin.Enum + (*Table)(nil), // 7: plugin.Table + (*Identifier)(nil), // 8: plugin.Identifier + (*Column)(nil), // 9: plugin.Column + (*Query)(nil), // 10: plugin.Query + (*Parameter)(nil), // 11: plugin.Parameter + (*CodeGenRequest)(nil), // 12: plugin.CodeGenRequest + (*CodeGenResponse)(nil), // 13: plugin.CodeGenResponse + (*Codegen_Process)(nil), // 14: plugin.Codegen.Process + (*Codegen_WASM)(nil), // 15: plugin.Codegen.WASM } var file_plugin_codegen_proto_depIdxs = []int32{ - 10, // 0: plugin.Override.table:type_name -> plugin.Identifier - 2, // 1: plugin.Override.go_type:type_name -> plugin.ParsedGoType - 16, // 2: plugin.ParsedGoType.struct_tags:type_name -> plugin.ParsedGoType.StructTagsEntry - 17, // 3: plugin.Settings.rename:type_name -> plugin.Settings.RenameEntry - 1, // 4: plugin.Settings.overrides:type_name -> plugin.Override - 4, // 5: plugin.Settings.codegen:type_name -> plugin.Codegen - 18, // 6: plugin.Codegen.process:type_name -> plugin.Codegen.Process - 19, // 7: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM - 6, // 8: plugin.Catalog.schemas:type_name -> plugin.Schema - 9, // 9: plugin.Schema.tables:type_name -> plugin.Table - 8, // 10: plugin.Schema.enums:type_name -> plugin.Enum - 7, // 11: plugin.Schema.composite_types:type_name -> plugin.CompositeType - 10, // 12: plugin.Table.rel:type_name -> plugin.Identifier - 11, // 13: plugin.Table.columns:type_name -> plugin.Column - 10, // 14: plugin.Column.table:type_name -> plugin.Identifier - 10, // 15: plugin.Column.type:type_name -> plugin.Identifier - 10, // 16: plugin.Column.embed_table:type_name -> plugin.Identifier - 11, // 17: plugin.Query.columns:type_name -> plugin.Column - 13, // 18: plugin.Query.params:type_name -> plugin.Parameter - 10, // 19: plugin.Query.insert_into_table:type_name -> plugin.Identifier - 11, // 20: plugin.Parameter.column:type_name -> plugin.Column - 3, // 21: plugin.CodeGenRequest.settings:type_name -> plugin.Settings - 5, // 22: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog - 12, // 23: plugin.CodeGenRequest.queries:type_name -> plugin.Query - 0, // 24: plugin.CodeGenResponse.files:type_name -> plugin.File - 25, // [25:25] is the sub-list for method output_type - 25, // [25:25] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name + 2, // 0: plugin.Settings.codegen:type_name -> plugin.Codegen + 14, // 1: plugin.Codegen.process:type_name -> plugin.Codegen.Process + 15, // 2: plugin.Codegen.wasm:type_name -> plugin.Codegen.WASM + 4, // 3: plugin.Catalog.schemas:type_name -> plugin.Schema + 7, // 4: plugin.Schema.tables:type_name -> plugin.Table + 6, // 5: plugin.Schema.enums:type_name -> plugin.Enum + 5, // 6: plugin.Schema.composite_types:type_name -> plugin.CompositeType + 8, // 7: plugin.Table.rel:type_name -> plugin.Identifier + 9, // 8: plugin.Table.columns:type_name -> plugin.Column + 8, // 9: plugin.Column.table:type_name -> plugin.Identifier + 8, // 10: plugin.Column.type:type_name -> plugin.Identifier + 8, // 11: plugin.Column.embed_table:type_name -> plugin.Identifier + 9, // 12: plugin.Query.columns:type_name -> plugin.Column + 11, // 13: plugin.Query.params:type_name -> plugin.Parameter + 8, // 14: plugin.Query.insert_into_table:type_name -> plugin.Identifier + 9, // 15: plugin.Parameter.column:type_name -> plugin.Column + 1, // 16: plugin.CodeGenRequest.settings:type_name -> plugin.Settings + 3, // 17: plugin.CodeGenRequest.catalog:type_name -> plugin.Catalog + 10, // 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 } func init() { file_plugin_codegen_proto_init() } @@ -1685,30 +1440,6 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Override); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParsedGoType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Settings); i { case 0: return &v.state @@ -1720,7 +1451,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Codegen); i { case 0: return &v.state @@ -1732,7 +1463,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Catalog); i { case 0: return &v.state @@ -1744,7 +1475,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Schema); i { case 0: return &v.state @@ -1756,7 +1487,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CompositeType); i { case 0: return &v.state @@ -1768,7 +1499,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Enum); i { case 0: return &v.state @@ -1780,7 +1511,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Table); i { case 0: return &v.state @@ -1792,7 +1523,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Identifier); i { case 0: return &v.state @@ -1804,7 +1535,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Column); i { case 0: return &v.state @@ -1816,7 +1547,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Query); i { case 0: return &v.state @@ -1828,7 +1559,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Parameter); i { case 0: return &v.state @@ -1840,7 +1571,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CodeGenRequest); i { case 0: return &v.state @@ -1852,7 +1583,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CodeGenResponse); i { case 0: return &v.state @@ -1864,7 +1595,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Codegen_Process); i { case 0: return &v.state @@ -1876,7 +1607,7 @@ func file_plugin_codegen_proto_init() { return nil } } - file_plugin_codegen_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_plugin_codegen_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Codegen_WASM); i { case 0: return &v.state @@ -1895,7 +1626,7 @@ func file_plugin_codegen_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_plugin_codegen_proto_rawDesc, NumEnums: 0, - NumMessages: 20, + NumMessages: 16, NumExtensions: 0, NumServices: 0, }, diff --git a/internal/plugin/codegen_vtproto.pb.go b/internal/plugin/codegen_vtproto.pb.go index 3ff0dc600f..26e558ee8e 100644 --- a/internal/plugin/codegen_vtproto.pb.go +++ b/internal/plugin/codegen_vtproto.pb.go @@ -42,59 +42,6 @@ func (m *File) CloneMessageVT() proto.Message { return m.CloneVT() } -func (m *Override) CloneVT() *Override { - if m == nil { - return (*Override)(nil) - } - r := &Override{ - CodeType: m.CodeType, - DbType: m.DbType, - Nullable: m.Nullable, - Column: m.Column, - Table: m.Table.CloneVT(), - ColumnName: m.ColumnName, - GoType: m.GoType.CloneVT(), - Unsigned: m.Unsigned, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Override) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ParsedGoType) CloneVT() *ParsedGoType { - if m == nil { - return (*ParsedGoType)(nil) - } - r := &ParsedGoType{ - ImportPath: m.ImportPath, - Package: m.Package, - TypeName: m.TypeName, - BasicType: m.BasicType, - } - if rhs := m.StructTags; rhs != nil { - tmpContainer := make(map[string]string, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v - } - r.StructTags = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ParsedGoType) CloneMessageVT() proto.Message { - return m.CloneVT() -} - func (m *Settings) CloneVT() *Settings { if m == nil { return (*Settings)(nil) @@ -114,20 +61,6 @@ func (m *Settings) CloneVT() *Settings { copy(tmpContainer, rhs) r.Queries = tmpContainer } - if rhs := m.Rename; rhs != nil { - tmpContainer := make(map[string]string, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v - } - r.Rename = tmpContainer - } - if rhs := m.Overrides; rhs != nil { - tmpContainer := make([]*Override, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Overrides = tmpContainer - } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -477,6 +410,11 @@ func (m *CodeGenRequest) CloneVT() *CodeGenRequest { copy(tmpBytes, rhs) r.PluginOptions = tmpBytes } + if rhs := m.GlobalOptions; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.GlobalOptions = tmpBytes + } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -533,86 +471,6 @@ func (this *File) EqualMessageVT(thatMsg proto.Message) bool { } return this.EqualVT(that) } -func (this *Override) EqualVT(that *Override) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.CodeType != that.CodeType { - return false - } - if this.DbType != that.DbType { - return false - } - if this.Nullable != that.Nullable { - return false - } - if this.Column != that.Column { - return false - } - if !this.Table.EqualVT(that.Table) { - return false - } - if this.ColumnName != that.ColumnName { - return false - } - if !this.GoType.EqualVT(that.GoType) { - return false - } - if this.Unsigned != that.Unsigned { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Override) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Override) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ParsedGoType) EqualVT(that *ParsedGoType) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ImportPath != that.ImportPath { - return false - } - if this.Package != that.Package { - return false - } - if this.TypeName != that.TypeName { - return false - } - if this.BasicType != that.BasicType { - return false - } - if len(this.StructTags) != len(that.StructTags) { - return false - } - for i, vx := range this.StructTags { - vy, ok := that.StructTags[i] - if !ok { - return false - } - if vx != vy { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ParsedGoType) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ParsedGoType) - if !ok { - return false - } - return this.EqualVT(that) -} func (this *Settings) EqualVT(that *Settings) bool { if this == that { return true @@ -643,35 +501,6 @@ func (this *Settings) EqualVT(that *Settings) bool { return false } } - if len(this.Rename) != len(that.Rename) { - return false - } - for i, vx := range this.Rename { - vy, ok := that.Rename[i] - if !ok { - return false - } - if vx != vy { - return false - } - } - if len(this.Overrides) != len(that.Overrides) { - return false - } - for i, vx := range this.Overrides { - vy := that.Overrides[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Override{} - } - if q == nil { - q = &Override{} - } - if !p.EqualVT(q) { - return false - } - } - } if !this.Codegen.EqualVT(that.Codegen) { return false } @@ -1193,6 +1022,9 @@ func (this *CodeGenRequest) EqualVT(that *CodeGenRequest) bool { if string(this.PluginOptions) != string(that.PluginOptions) { return false } + if string(this.GlobalOptions) != string(that.GlobalOptions) { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -1283,7 +1115,7 @@ func (m *File) MarshalToSizedBufferVT(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Override) MarshalVT() (dAtA []byte, err error) { +func (m *Settings) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -1296,12 +1128,12 @@ func (m *Override) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Override) MarshalToVT(dAtA []byte) (int, error) { +func (m *Settings) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *Override) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Settings) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -1313,78 +1145,52 @@ func (m *Override) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.GoType != nil { - size, err := m.GoType.MarshalToSizedBufferVT(dAtA[:i]) + if m.Codegen != nil { + size, err := m.Codegen.MarshalToSizedBufferVT(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarint(dAtA, i, uint64(size)) i-- - dAtA[i] = 0x52 - } - if len(m.ColumnName) > 0 { - i -= len(m.ColumnName) - copy(dAtA[i:], m.ColumnName) - i = encodeVarint(dAtA, i, uint64(len(m.ColumnName))) - i-- - dAtA[i] = 0x42 + dAtA[i] = 0x62 } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Queries) > 0 { + for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Queries[iNdEx]) + copy(dAtA[i:], m.Queries[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) + i-- + dAtA[i] = 0x22 } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.Column) > 0 { - i -= len(m.Column) - copy(dAtA[i:], m.Column) - i = encodeVarint(dAtA, i, uint64(len(m.Column))) - i-- - dAtA[i] = 0x32 } - if m.Nullable { - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.Schema) > 0 { + for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Schema[iNdEx]) + copy(dAtA[i:], m.Schema[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x28 } - if len(m.DbType) > 0 { - i -= len(m.DbType) - copy(dAtA[i:], m.DbType) - i = encodeVarint(dAtA, i, uint64(len(m.DbType))) + if len(m.Engine) > 0 { + i -= len(m.Engine) + copy(dAtA[i:], m.Engine) + i = encodeVarint(dAtA, i, uint64(len(m.Engine))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } - if len(m.CodeType) > 0 { - i -= len(m.CodeType) - copy(dAtA[i:], m.CodeType) - i = encodeVarint(dAtA, i, uint64(len(m.CodeType))) + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarint(dAtA, i, uint64(len(m.Version))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ParsedGoType) MarshalVT() (dAtA []byte, err error) { +func (m *Codegen_Process) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -1397,12 +1203,12 @@ func (m *ParsedGoType) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ParsedGoType) MarshalToVT(dAtA []byte) (int, error) { +func (m *Codegen_Process) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *ParsedGoType) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Codegen_Process) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -1414,60 +1220,64 @@ func (m *ParsedGoType) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.StructTags) > 0 { - for k := range m.StructTags { - v := m.StructTags[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.BasicType { - i-- - if m.BasicType { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + if len(m.Cmd) > 0 { + i -= len(m.Cmd) + copy(dAtA[i:], m.Cmd) + i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) i-- - dAtA[i] = 0x20 + dAtA[i] = 0xa } - if len(m.TypeName) > 0 { - i -= len(m.TypeName) - copy(dAtA[i:], m.TypeName) - i = encodeVarint(dAtA, i, uint64(len(m.TypeName))) - i-- - dAtA[i] = 0x1a + return len(dAtA) - i, nil +} + +func (m *Codegen_WASM) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Codegen_WASM) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Codegen_WASM) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) + if len(m.Sha256) > 0 { + i -= len(m.Sha256) + copy(dAtA[i:], m.Sha256) + i = encodeVarint(dAtA, i, uint64(len(m.Sha256))) i-- dAtA[i] = 0x12 } - if len(m.ImportPath) > 0 { - i -= len(m.ImportPath) - copy(dAtA[i:], m.ImportPath) - i = encodeVarint(dAtA, i, uint64(len(m.ImportPath))) + if len(m.Url) > 0 { + i -= len(m.Url) + copy(dAtA[i:], m.Url) + i = encodeVarint(dAtA, i, uint64(len(m.Url))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *Settings) MarshalVT() (dAtA []byte, err error) { +func (m *Codegen) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -1480,12 +1290,12 @@ func (m *Settings) MarshalVT() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Settings) MarshalToVT(dAtA []byte) (int, error) { +func (m *Codegen) MarshalToVT(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVT(dAtA[:size]) } -func (m *Settings) MarshalToSizedBufferVT(dAtA []byte) (int, error) { +func (m *Codegen) MarshalToSizedBufferVT(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -1497,208 +1307,15 @@ func (m *Settings) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if m.Codegen != nil { - size, err := m.Codegen.MarshalToSizedBufferVT(dAtA[:i]) + if m.Wasm != nil { + size, err := m.Wasm.MarshalToSizedBufferVT(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarint(dAtA, i, uint64(size)) i-- - dAtA[i] = 0x62 - } - if len(m.Overrides) > 0 { - for iNdEx := len(m.Overrides) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Overrides[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Rename) > 0 { - for k := range m.Rename { - v := m.Rename[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Queries[iNdEx]) - copy(dAtA[i:], m.Queries[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Schema[iNdEx]) - copy(dAtA[i:], m.Schema[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Engine) > 0 { - i -= len(m.Engine) - copy(dAtA[i:], m.Engine) - i = encodeVarint(dAtA, i, uint64(len(m.Engine))) - i-- - dAtA[i] = 0x12 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarint(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_Process) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_Process) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen_Process) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_WASM) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_WASM) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen_WASM) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Sha256) > 0 { - i -= len(m.Sha256) - copy(dAtA[i:], m.Sha256) - i = encodeVarint(dAtA, i, uint64(len(m.Sha256))) - i-- - dAtA[i] = 0x12 - } - if len(m.Url) > 0 { - i -= len(m.Url) - copy(dAtA[i:], m.Url) - i = encodeVarint(dAtA, i, uint64(len(m.Url))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Codegen) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Wasm != nil { - size, err := m.Wasm.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 + dAtA[i] = 0x32 } if m.Process != nil { size, err := m.Process.MarshalToSizedBufferVT(dAtA[:i]) @@ -2465,6 +2082,13 @@ func (m *CodeGenRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.GlobalOptions) > 0 { + i -= len(m.GlobalOptions) + copy(dAtA[i:], m.GlobalOptions) + i = encodeVarint(dAtA, i, uint64(len(m.GlobalOptions))) + i-- + dAtA[i] = 0x32 + } if len(m.PluginOptions) > 0 { i -= len(m.PluginOptions) copy(dAtA[i:], m.PluginOptions) @@ -2617,7 +2241,7 @@ func (m *File) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Override) MarshalVTStrict() (dAtA []byte, err error) { +func (m *Settings) MarshalVTStrict() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -2630,12 +2254,12 @@ func (m *Override) MarshalVTStrict() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Override) MarshalToVTStrict(dAtA []byte) (int, error) { +func (m *Settings) MarshalToVTStrict(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVTStrict(dAtA[:size]) } -func (m *Override) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { +func (m *Settings) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -2647,78 +2271,52 @@ func (m *Override) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if m.GoType != nil { - size, err := m.GoType.MarshalToSizedBufferVTStrict(dAtA[:i]) + if m.Codegen != nil { + size, err := m.Codegen.MarshalToSizedBufferVTStrict(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarint(dAtA, i, uint64(size)) i-- - dAtA[i] = 0x52 - } - if len(m.ColumnName) > 0 { - i -= len(m.ColumnName) - copy(dAtA[i:], m.ColumnName) - i = encodeVarint(dAtA, i, uint64(len(m.ColumnName))) - i-- - dAtA[i] = 0x42 + dAtA[i] = 0x62 } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Queries) > 0 { + for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Queries[iNdEx]) + copy(dAtA[i:], m.Queries[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) + i-- + dAtA[i] = 0x22 } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x3a - } - if len(m.Column) > 0 { - i -= len(m.Column) - copy(dAtA[i:], m.Column) - i = encodeVarint(dAtA, i, uint64(len(m.Column))) - i-- - dAtA[i] = 0x32 } - if m.Nullable { - i-- - if m.Nullable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.Schema) > 0 { + for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Schema[iNdEx]) + copy(dAtA[i:], m.Schema[iNdEx]) + i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x28 } - if len(m.DbType) > 0 { - i -= len(m.DbType) - copy(dAtA[i:], m.DbType) - i = encodeVarint(dAtA, i, uint64(len(m.DbType))) + if len(m.Engine) > 0 { + i -= len(m.Engine) + copy(dAtA[i:], m.Engine) + i = encodeVarint(dAtA, i, uint64(len(m.Engine))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } - if len(m.CodeType) > 0 { - i -= len(m.CodeType) - copy(dAtA[i:], m.CodeType) - i = encodeVarint(dAtA, i, uint64(len(m.CodeType))) + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarint(dAtA, i, uint64(len(m.Version))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ParsedGoType) MarshalVTStrict() (dAtA []byte, err error) { +func (m *Codegen_Process) MarshalVTStrict() (dAtA []byte, err error) { if m == nil { return nil, nil } @@ -2731,12 +2329,12 @@ func (m *ParsedGoType) MarshalVTStrict() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ParsedGoType) MarshalToVTStrict(dAtA []byte) (int, error) { +func (m *Codegen_Process) MarshalToVTStrict(dAtA []byte) (int, error) { size := m.SizeVT() return m.MarshalToSizedBufferVTStrict(dAtA[:size]) } -func (m *ParsedGoType) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { +func (m *Codegen_Process) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -2748,199 +2346,10 @@ func (m *ParsedGoType) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.StructTags) > 0 { - for k := range m.StructTags { - v := m.StructTags[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.BasicType { - i-- - if m.BasicType { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.TypeName) > 0 { - i -= len(m.TypeName) - copy(dAtA[i:], m.TypeName) - i = encodeVarint(dAtA, i, uint64(len(m.TypeName))) - i-- - dAtA[i] = 0x1a - } - if len(m.Package) > 0 { - i -= len(m.Package) - copy(dAtA[i:], m.Package) - i = encodeVarint(dAtA, i, uint64(len(m.Package))) - i-- - dAtA[i] = 0x12 - } - if len(m.ImportPath) > 0 { - i -= len(m.ImportPath) - copy(dAtA[i:], m.ImportPath) - i = encodeVarint(dAtA, i, uint64(len(m.ImportPath))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settings) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Settings) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Settings) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Codegen != nil { - size, err := m.Codegen.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.Overrides) > 0 { - for iNdEx := len(m.Overrides) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Overrides[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Rename) > 0 { - for k := range m.Rename { - v := m.Rename[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarint(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Queries[iNdEx]) - copy(dAtA[i:], m.Queries[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Queries[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Schema) > 0 { - for iNdEx := len(m.Schema) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Schema[iNdEx]) - copy(dAtA[i:], m.Schema[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Schema[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Engine) > 0 { - i -= len(m.Engine) - copy(dAtA[i:], m.Engine) - i = encodeVarint(dAtA, i, uint64(len(m.Engine))) - i-- - dAtA[i] = 0x12 - } - if len(m.Version) > 0 { - i -= len(m.Version) - copy(dAtA[i:], m.Version) - i = encodeVarint(dAtA, i, uint64(len(m.Version))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_Process) MarshalVTStrict() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Codegen_Process) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen_Process) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Cmd) > 0 { - i -= len(m.Cmd) - copy(dAtA[i:], m.Cmd) - i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) + if len(m.Cmd) > 0 { + i -= len(m.Cmd) + copy(dAtA[i:], m.Cmd) + i = encodeVarint(dAtA, i, uint64(len(m.Cmd))) i-- dAtA[i] = 0xa } @@ -3799,6 +3208,13 @@ func (m *CodeGenRequest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if len(m.GlobalOptions) > 0 { + i -= len(m.GlobalOptions) + copy(dAtA[i:], m.GlobalOptions) + i = encodeVarint(dAtA, i, uint64(len(m.GlobalOptions))) + i-- + dAtA[i] = 0x32 + } if len(m.PluginOptions) > 0 { i -= len(m.PluginOptions) copy(dAtA[i:], m.PluginOptions) @@ -3911,79 +3327,6 @@ func (m *File) SizeVT() (n int) { return n } -func (m *Override) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CodeType) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.DbType) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Nullable { - n += 2 - } - l = len(m.Column) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Table != nil { - l = m.Table.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.ColumnName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.GoType != nil { - l = m.GoType.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Unsigned { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *ParsedGoType) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ImportPath) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Package) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.TypeName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.BasicType { - n += 2 - } - if len(m.StructTags) > 0 { - for k, v := range m.StructTags { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) - n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) - } - } - n += len(m.unknownFields) - return n -} - func (m *Settings) SizeVT() (n int) { if m == nil { return 0 @@ -4010,20 +3353,6 @@ func (m *Settings) SizeVT() (n int) { n += 1 + l + sov(uint64(l)) } } - if len(m.Rename) > 0 { - for k, v := range m.Rename { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sov(uint64(len(k))) + 1 + len(v) + sov(uint64(len(v))) - n += mapEntrySize + 1 + sov(uint64(mapEntrySize)) - } - } - if len(m.Overrides) > 0 { - for _, e := range m.Overrides { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } if m.Codegen != nil { l = m.Codegen.SizeVT() n += 1 + l + sov(uint64(l)) @@ -4366,486 +3695,82 @@ func (m *Query) SizeVT() (n int) { return n } -func (m *Parameter) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Number != 0 { - n += 1 + sov(uint64(m.Number)) - } - if m.Column != nil { - l = m.Column.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CodeGenRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Settings != nil { - l = m.Settings.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Catalog != nil { - l = m.Catalog.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if len(m.Queries) > 0 { - for _, e := range m.Queries { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.SqlcVersion) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.PluginOptions) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *CodeGenResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Files) > 0 { - for _, e := range m.Files { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func sov(x uint64) (n int) { - return (bits.Len64(x|1) + 6) / 7 -} -func soz(x uint64) (n int) { - return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *File) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: File: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: File: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contents = append(m.Contents[:0], dAtA[iNdEx:postIndex]...) - if m.Contents == nil { - m.Contents = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Override) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Override: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Override: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CodeType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DbType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DbType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nullable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Nullable = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Column = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Table == nil { - m.Table = &Identifier{} - } - if err := m.Table.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ColumnName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GoType", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GoType == nil { - m.GoType = &ParsedGoType{} - } - if err := m.GoType.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unsigned", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Unsigned = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy +func (m *Parameter) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Number != 0 { + n += 1 + sov(uint64(m.Number)) + } + if m.Column != nil { + l = m.Column.SizeVT() + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *CodeGenRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Settings != nil { + l = m.Settings.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if m.Catalog != nil { + l = m.Catalog.SizeVT() + n += 1 + l + sov(uint64(l)) + } + if len(m.Queries) > 0 { + for _, e := range m.Queries { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) } } + l = len(m.SqlcVersion) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.PluginOptions) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.GlobalOptions) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *CodeGenResponse) SizeVT() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + if len(m.Files) > 0 { + for _, e := range m.Files { + l = e.SizeVT() + n += 1 + l + sov(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func sov(x uint64) (n int) { + return (bits.Len64(x|1) + 6) / 7 +} +func soz(x uint64) (n int) { + return sov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *ParsedGoType) UnmarshalVT(dAtA []byte) error { +func (m *File) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4868,15 +3793,15 @@ func (m *ParsedGoType) UnmarshalVT(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ParsedGoType: wiretype end group for non-group") + return fmt.Errorf("proto: File: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ParsedGoType: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: File: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ImportPath", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4904,45 +3829,13 @@ func (m *ParsedGoType) UnmarshalVT(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ImportPath = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Package", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Package = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflow @@ -4952,170 +3845,25 @@ func (m *ParsedGoType) UnmarshalVT(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLength } if postIndex > l { return io.ErrUnexpectedEOF } - m.TypeName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasicType", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BasicType = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StructTags", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF + m.Contents = append(m.Contents[:0], dAtA[iNdEx:postIndex]...) + if m.Contents == nil { + m.Contents = []byte{} } - if m.StructTags == nil { - m.StructTags = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLength - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.StructTags[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -5296,167 +4044,6 @@ func (m *Settings) UnmarshalVT(dAtA []byte) error { } m.Queries = append(m.Queries, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rename", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Rename == nil { - m.Rename = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLength - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLength - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Rename[mapkey] = mapvalue - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Overrides", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Overrides = append(m.Overrides, &Override{}) - if err := m.Overrides[len(m.Overrides)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Codegen", wireType) @@ -8025,6 +6612,40 @@ func (m *CodeGenRequest) UnmarshalVT(dAtA []byte) error { m.PluginOptions = []byte{} } iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GlobalOptions", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GlobalOptions = append(m.GlobalOptions[:0], dAtA[iNdEx:postIndex]...) + if m.GlobalOptions == nil { + m.GlobalOptions = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index 380ecf2777..1d0355cb20 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -9,53 +9,19 @@ message File { bytes contents = 2 [json_name = "contents"]; } -message Override { - // PythonType message was field 9 - reserved 9; - - // 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"]; - - // 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"]; - - Identifier table = 7 [json_name = "table"]; - - string column_name = 8 [json_name = "column_name"]; - - ParsedGoType go_type = 10; - - // True if the override should apply to a unsigned database type - bool unsigned = 11 [json_name = "unsigned"]; -} - -message ParsedGoType { - string import_path = 1; - string package = 2; - string type_name = 3; - bool basic_type = 4; - map struct_tags = 5; -} - message Settings { + // Rename message was field 5 + // Overides message was field 6 // PythonCode message was field 8 // KotlinCode message was field 9 // GoCode message was field 10; // JSONCode message was field 11; - reserved 8, 9, 10, 11; + reserved 5, 8, 9, 10, 11; string version = 1 [json_name = "version"]; string engine = 2 [json_name = "engine"]; repeated string schema = 3 [json_name = "schema"]; repeated string queries = 4 [json_name = "queries"]; - map rename = 5 [json_name = "rename"]; - repeated Override overrides = 6 [json_name = "overrides"]; Codegen codegen = 12 [json_name = "codegen"]; } @@ -156,6 +122,7 @@ message CodeGenRequest { repeated Query queries = 3 [json_name = "queries"]; string sqlc_version = 4 [json_name = "sqlc_version"]; bytes plugin_options = 5 [json_name = "plugin_options"]; + bytes global_options = 6 [json_name = "global_options"]; } message CodeGenResponse {