diff --git a/buf.gen.yaml b/buf.gen.yaml index 63146b4ee3..7992b00577 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -5,6 +5,6 @@ plugins: - plugin: buf.build/protocolbuffers/go:v1.30.0 out: internal opt: paths=source_relative - - plugin: buf.build/community/planetscale-vtprotobuf:v0.4.0 + - plugin: buf.build/grpc/go:v1.3.0 out: internal opt: paths=source_relative diff --git a/cmd/sqlc-gen-json/main.go b/cmd/sqlc-gen-json/main.go index 421a14e06d..05c804d082 100644 --- a/cmd/sqlc-gen-json/main.go +++ b/cmd/sqlc-gen-json/main.go @@ -9,6 +9,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/codegen/json" "github.com/sqlc-dev/sqlc/internal/plugin" + "google.golang.org/protobuf/proto" ) func main() { @@ -19,19 +20,19 @@ func main() { } func run() error { - var req plugin.CodeGenRequest + var req plugin.GenerateRequest reqBlob, err := io.ReadAll(os.Stdin) if err != nil { return err } - if err := req.UnmarshalVT(reqBlob); err != nil { + if err := proto.Unmarshal(reqBlob, &req); err != nil { return err } resp, err := json.Generate(context.Background(), &req) if err != nil { return err } - respBlob, err := resp.MarshalVT() + respBlob, err := proto.Marshal(resp) if err != nil { return err } diff --git a/internal/cmd/generate.go b/internal/cmd/generate.go index 033226e8bf..0865705db7 100644 --- a/internal/cmd/generate.go +++ b/internal/cmd/generate.go @@ -14,6 +14,7 @@ import ( "sync" "golang.org/x/sync/errgroup" + "google.golang.org/grpc" "google.golang.org/grpc/status" "github.com/sqlc-dev/sqlc/internal/codegen/golang" @@ -380,10 +381,10 @@ func parse(ctx context.Context, name, dir string, sql config.SQL, combo config.C return c.Result(), false } -func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, result *compiler.Result) (string, *plugin.CodeGenResponse, error) { +func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, result *compiler.Result) (string, *plugin.GenerateResponse, error) { defer trace.StartRegion(ctx, "codegen").End() req := codeGenRequest(result, combo) - var handler ext.Handler + var handler grpc.ClientConnInterface var out string switch { case sql.Plugin != nil: @@ -453,6 +454,7 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re default: return "", nil, fmt.Errorf("missing language backend") } - resp, err := handler.Generate(ctx, req) + client := plugin.NewCodegenServiceClient(handler) + resp, err := client.Generate(ctx, req) return out, resp, err } diff --git a/internal/cmd/shim.go b/internal/cmd/shim.go index 194afd0c81..654500429a 100644 --- a/internal/cmd/shim.go +++ b/internal/cmd/shim.go @@ -223,8 +223,8 @@ func pluginQueryParam(p compiler.Parameter) *plugin.Parameter { } } -func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.CodeGenRequest { - return &plugin.CodeGenRequest{ +func codeGenRequest(r *compiler.Result, settings config.CombinedSettings) *plugin.GenerateRequest { + return &plugin.GenerateRequest{ Settings: pluginSettings(r, settings), Catalog: pluginCatalog(r.Catalog), Queries: pluginQueries(r), diff --git a/internal/cmd/vet.go b/internal/cmd/vet.go index 2d3e1c24b3..07a7722a9f 100644 --- a/internal/cmd/vet.go +++ b/internal/cmd/vet.go @@ -627,7 +627,7 @@ func (c *checker) checkSQL(ctx context.Context, s config.SQL) error { return nil } -func vetConfig(req *plugin.CodeGenRequest) *vet.Config { +func vetConfig(req *plugin.GenerateRequest) *vet.Config { return &vet.Config{ Version: req.Settings.Version, Engine: req.Settings.Engine, diff --git a/internal/codegen/golang/gen.go b/internal/codegen/golang/gen.go index 9a2fe5f26c..5b8289d447 100644 --- a/internal/codegen/golang/gen.go +++ b/internal/codegen/golang/gen.go @@ -103,7 +103,7 @@ func (t *tmplCtx) codegenQueryRetval(q Query) (string, error) { } } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { options, err := opts.Parse(req) if err != nil { return nil, err @@ -127,7 +127,7 @@ func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenR return generate(req, options, enums, structs, queries) } -func generate(req *plugin.CodeGenRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.CodeGenResponse, error) { +func generate(req *plugin.GenerateRequest, options *opts.Options, enums []Enum, structs []Struct, queries []Query) (*plugin.GenerateResponse, error) { i := &importer{ Options: options, Queries: queries, @@ -282,7 +282,7 @@ func generate(req *plugin.CodeGenRequest, options *opts.Options, enums []Enum, s return nil, err } } - resp := plugin.CodeGenResponse{} + resp := plugin.GenerateResponse{} for filename, code := range output { resp.Files = append(resp.Files, &plugin.File{ diff --git a/internal/codegen/golang/go_type.go b/internal/codegen/golang/go_type.go index f3f52a5097..4c491cba5a 100644 --- a/internal/codegen/golang/go_type.go +++ b/internal/codegen/golang/go_type.go @@ -8,7 +8,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) { +func addExtraGoStructTags(tags map[string]string, req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) { for _, override := range options.Overrides { oride := override.ShimOverride if oride.GoType.StructTags == nil { @@ -33,7 +33,7 @@ func addExtraGoStructTags(tags map[string]string, req *plugin.CodeGenRequest, op } } -func goType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func goType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { // Check if the column's type has been overridden for _, override := range options.Overrides { oride := override.ShimOverride @@ -63,7 +63,7 @@ func goType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Colum return typ } -func goInnerType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray diff --git a/internal/codegen/golang/mysql_type.go b/internal/codegen/golang/mysql_type.go index 77f993635f..32e1df68c3 100644 --- a/internal/codegen/golang/mysql_type.go +++ b/internal/codegen/golang/mysql_type.go @@ -9,7 +9,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func mysqlType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func mysqlType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray unsigned := col.Unsigned diff --git a/internal/codegen/golang/opts/options.go b/internal/codegen/golang/opts/options.go index 6b6e289f39..513d21ef2f 100644 --- a/internal/codegen/golang/opts/options.go +++ b/internal/codegen/golang/opts/options.go @@ -47,7 +47,7 @@ type GlobalOptions struct { Rename map[string]string `json:"rename,omitempty" yaml:"rename"` } -func Parse(req *plugin.CodeGenRequest) (*Options, error) { +func Parse(req *plugin.GenerateRequest) (*Options, error) { options, err := parseOpts(req) if err != nil { return nil, err @@ -68,7 +68,7 @@ func Parse(req *plugin.CodeGenRequest) (*Options, error) { return options, nil } -func parseOpts(req *plugin.CodeGenRequest) (*Options, error) { +func parseOpts(req *plugin.GenerateRequest) (*Options, error) { var options Options if len(req.PluginOptions) == 0 { return &options, nil @@ -91,7 +91,7 @@ func parseOpts(req *plugin.CodeGenRequest) (*Options, error) { return &options, nil } -func parseGlobalOpts(req *plugin.CodeGenRequest) (*GlobalOptions, error) { +func parseGlobalOpts(req *plugin.GenerateRequest) (*GlobalOptions, error) { var options GlobalOptions if len(req.GlobalOptions) == 0 { return &options, nil diff --git a/internal/codegen/golang/opts/override.go b/internal/codegen/golang/opts/override.go index 3b7fc531c3..4a1b6f2903 100644 --- a/internal/codegen/golang/opts/override.go +++ b/internal/codegen/golang/opts/override.go @@ -76,7 +76,7 @@ func (o *Override) Matches(n *plugin.Identifier, defaultSchema string) bool { return true } -func (o *Override) parse(req *plugin.CodeGenRequest) (err error) { +func (o *Override) parse(req *plugin.GenerateRequest) (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") diff --git a/internal/codegen/golang/opts/shim.go b/internal/codegen/golang/opts/shim.go index 500db15280..7912e17664 100644 --- a/internal/codegen/golang/opts/shim.go +++ b/internal/codegen/golang/opts/shim.go @@ -21,7 +21,7 @@ type ShimOverride struct { GoType *ShimGoType } -func shimOverride(req *plugin.CodeGenRequest, o *Override) *ShimOverride { +func shimOverride(req *plugin.GenerateRequest, o *Override) *ShimOverride { var column string var table plugin.Identifier diff --git a/internal/codegen/golang/postgresql_type.go b/internal/codegen/golang/postgresql_type.go index 5a5f1919ba..855d5425c0 100644 --- a/internal/codegen/golang/postgresql_type.go +++ b/internal/codegen/golang/postgresql_type.go @@ -34,7 +34,7 @@ func parseIdentifierString(name string) (*plugin.Identifier, error) { } } -func postgresType(req *plugin.CodeGenRequest, options *opts.Options, col *plugin.Column) string { +func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string { columnType := sdk.DataType(col.Type) notNull := col.NotNull || col.IsArray driver := parseDriver(options.SqlPackage) diff --git a/internal/codegen/golang/result.go b/internal/codegen/golang/result.go index 3d7046d808..b98c578c54 100644 --- a/internal/codegen/golang/result.go +++ b/internal/codegen/golang/result.go @@ -12,7 +12,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func buildEnums(req *plugin.CodeGenRequest, options *opts.Options) []Enum { +func buildEnums(req *plugin.GenerateRequest, options *opts.Options) []Enum { var enums []Enum for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -59,7 +59,7 @@ func buildEnums(req *plugin.CodeGenRequest, options *opts.Options) []Enum { return enums } -func buildStructs(req *plugin.CodeGenRequest, options *opts.Options) []Struct { +func buildStructs(req *plugin.GenerateRequest, options *opts.Options) []Struct { var structs []Struct for _, schema := range req.Catalog.Schemas { if schema.Name == "pg_catalog" || schema.Name == "information_schema" { @@ -182,7 +182,7 @@ func argName(name string) string { return out } -func buildQueries(req *plugin.CodeGenRequest, options *opts.Options, structs []Struct) ([]Query, error) { +func buildQueries(req *plugin.GenerateRequest, options *opts.Options, structs []Struct) ([]Query, error) { qs := make([]Query, 0, len(req.Queries)) for _, query := range req.Queries { if query.Name == "" { @@ -332,7 +332,7 @@ func putOutColumns(query *plugin.Query) bool { // JSON tags: count, count_2, count_2 // // This is unlikely to happen, so don't fix it yet -func columnsToStruct(req *plugin.CodeGenRequest, options *opts.Options, name string, columns []goColumn, useID bool) (*Struct, error) { +func columnsToStruct(req *plugin.GenerateRequest, options *opts.Options, name string, columns []goColumn, useID bool) (*Struct, error) { gs := Struct{ Name: name, } diff --git a/internal/codegen/golang/sqlite_type.go b/internal/codegen/golang/sqlite_type.go index 2581197fd5..a0117e69e4 100644 --- a/internal/codegen/golang/sqlite_type.go +++ b/internal/codegen/golang/sqlite_type.go @@ -9,7 +9,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func sqliteType(req *plugin.CodeGenRequest, col *plugin.Column) string { +func sqliteType(req *plugin.GenerateRequest, col *plugin.Column) string { dt := strings.ToLower(sdk.DataType(col.Type)) notNull := col.NotNull || col.IsArray diff --git a/internal/codegen/json/gen.go b/internal/codegen/json/gen.go index b7e4057780..ad797efd92 100644 --- a/internal/codegen/json/gen.go +++ b/internal/codegen/json/gen.go @@ -11,7 +11,7 @@ import ( "github.com/sqlc-dev/sqlc/internal/plugin" ) -func parseOptions(req *plugin.CodeGenRequest) (*opts, error) { +func parseOptions(req *plugin.GenerateRequest) (*opts, error) { if len(req.PluginOptions) == 0 { return new(opts), nil } @@ -25,7 +25,7 @@ func parseOptions(req *plugin.CodeGenRequest) (*opts, error) { return options, nil } -func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { options, err := parseOptions(req) if err != nil { return nil, err @@ -57,7 +57,7 @@ func Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenR if err != nil { return nil, err } - return &plugin.CodeGenResponse{ + return &plugin.GenerateResponse{ Files: []*plugin.File{ { Name: filename, diff --git a/internal/ext/handler.go b/internal/ext/handler.go index adeacff695..2542dc1a82 100644 --- a/internal/ext/handler.go +++ b/internal/ext/handler.go @@ -2,22 +2,51 @@ package ext import ( "context" + "fmt" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/sqlc-dev/sqlc/internal/plugin" ) type Handler interface { - Generate(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) + Generate(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error) + + Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error + NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) } type wrapper struct { - fn func(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) + fn func(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error) } -func (w *wrapper) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func (w *wrapper) Generate(ctx context.Context, req *plugin.GenerateRequest) (*plugin.GenerateResponse, error) { return w.fn(ctx, req) } -func HandleFunc(fn func(context.Context, *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error)) Handler { +func (w *wrapper) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(*plugin.GenerateRequest) + if !ok { + return fmt.Errorf("args isn't a GenerateRequest") + } + resp, ok := reply.(*plugin.GenerateResponse) + if !ok { + return fmt.Errorf("reply isn't a GenerateResponse") + } + res, err := w.Generate(ctx, req) + if err != nil { + return err + } + resp.Files = res.Files + return nil +} + +func (w *wrapper) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") +} + +func HandleFunc(fn func(context.Context, *plugin.GenerateRequest) (*plugin.GenerateResponse, error)) Handler { return &wrapper{fn} } diff --git a/internal/ext/process/gen.go b/internal/ext/process/gen.go index 8022941ed4..b677f6805a 100644 --- a/internal/ext/process/gen.go +++ b/internal/ext/process/gen.go @@ -8,9 +8,13 @@ import ( "os" "os/exec" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" - "github.com/sqlc-dev/sqlc/internal/plugin" + "github.com/sqlc-dev/sqlc/internal/info" ) type Runner struct { @@ -18,23 +22,27 @@ type Runner struct { Env []string } -// TODO: Update the gen func signature to take a ctx -func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("args isn't a protoreflect.ProtoMessage") + } + stdin, err := proto.Marshal(req) if err != nil { - return nil, fmt.Errorf("failed to encode codegen request: %s", err) + return fmt.Errorf("failed to encode codegen request: %w", err) } // Check if the output plugin exists path, err := exec.LookPath(r.Cmd) if err != nil { - return nil, fmt.Errorf("process: %s not found", r.Cmd) + return fmt.Errorf("process: %s not found", r.Cmd) } - cmd := exec.CommandContext(ctx, path) + cmd := exec.CommandContext(ctx, path, method) cmd.Stdin = bytes.NewReader(stdin) cmd.Env = []string{ - fmt.Sprintf("SQLC_VERSION=%s", req.SqlcVersion), + fmt.Sprintf("SQLC_VERSION=%s", info.Version), } for _, key := range r.Env { if key == "SQLC_AUTH_TOKEN" { @@ -50,13 +58,21 @@ func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plug if errors.As(err, &exit) { stderr = string(exit.Stderr) } - return nil, fmt.Errorf("process: error running command %s", stderr) + return fmt.Errorf("process: error running command %s", stderr) + } + + resp, ok := reply.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("reply isn't a protoreflect.ProtoMessage") } - var resp plugin.CodeGenResponse - if err := proto.Unmarshal(out, &resp); err != nil { - return nil, fmt.Errorf("process: failed to read codegen resp: %s", err) + if err := proto.Unmarshal(out, resp); err != nil { + return fmt.Errorf("process: failed to read codegen resp: %w", err) } - return &resp, nil + return nil +} + +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") } diff --git a/internal/ext/wasm/nowasm.go b/internal/ext/wasm/nowasm.go index c28db6fc73..419c6eefef 100644 --- a/internal/ext/wasm/nowasm.go +++ b/internal/ext/wasm/nowasm.go @@ -4,11 +4,16 @@ package wasm import ( "context" - "fmt" - "github.com/sqlc-dev/sqlc/internal/plugin" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) -func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { - return nil, fmt.Errorf("sqlc built without wasmtime support") +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + return status.Error(codes.FailedPrecondition, "sqlc built without wasmtime support") +} + +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, codes.Unimplemented.String()) } diff --git a/internal/ext/wasm/wasm.go b/internal/ext/wasm/wasm.go index f626dbfd14..ca07805e48 100644 --- a/internal/ext/wasm/wasm.go +++ b/internal/ext/wasm/wasm.go @@ -19,6 +19,11 @@ import ( wasmtime "github.com/bytecodealliance/wasmtime-go/v14" "golang.org/x/sync/singleflight" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" "github.com/sqlc-dev/sqlc/internal/cache" "github.com/sqlc-dev/sqlc/internal/info" @@ -189,7 +194,7 @@ func (r *Runner) loadWASM(ctx context.Context, cache string, expected string) ([ // mysterious (reason unknown) bug with wasm plugins when a large amount of // tables (like there are in the catalog) are sent. // @see https://github.com/sqlc-dev/sqlc/pull/1748 -func removePGCatalog(req *plugin.CodeGenRequest) { +func removePGCatalog(req *plugin.GenerateRequest) { if req.Catalog == nil || req.Catalog.Schemas == nil { return } @@ -206,29 +211,38 @@ func removePGCatalog(req *plugin.CodeGenRequest) { req.Catalog.Schemas = filtered } -func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { +func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any, opts ...grpc.CallOption) error { + req, ok := args.(protoreflect.ProtoMessage) + if !ok { + return status.Error(codes.InvalidArgument, "args isn't a protoreflect.ProtoMessage") + } + // Remove the pg_catalog schema. Its sheer size causes unknown issues with wasm plugins - removePGCatalog(req) + genReq, ok := req.(*plugin.GenerateRequest) + if ok { + removePGCatalog(genReq) + req = genReq + } - stdinBlob, err := req.MarshalVT() + stdinBlob, err := proto.Marshal(req) if err != nil { - return nil, err + return fmt.Errorf("failed to encode codegen request: %w", err) } engine := wasmtime.NewEngine() module, err := r.loadModule(ctx, engine) if err != nil { - return nil, fmt.Errorf("loadModule: %w", err) + return fmt.Errorf("loadModule: %w", err) } linker := wasmtime.NewLinker(engine) if err := linker.DefineWasi(); err != nil { - return nil, err + return err } dir, err := os.MkdirTemp(os.Getenv("SQLCTMPDIR"), "out") if err != nil { - return nil, fmt.Errorf("temp dir: %w", err) + return fmt.Errorf("temp dir: %w", err) } defer os.RemoveAll(dir) @@ -237,17 +251,18 @@ func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plu stdoutPath := filepath.Join(dir, "stdout") if err := os.WriteFile(stdinPath, stdinBlob, 0755); err != nil { - return nil, fmt.Errorf("write file: %w", err) + return fmt.Errorf("write file: %w", err) } // Configure WASI imports to write stdout into a file. wasiConfig := wasmtime.NewWasiConfig() + wasiConfig.SetArgv([]string{"plugin.wasm", method}) wasiConfig.SetStdinFile(stdinPath) wasiConfig.SetStdoutFile(stdoutPath) wasiConfig.SetStderrFile(stderrPath) keys := []string{"SQLC_VERSION"} - vals := []string{req.SqlcVersion} + vals := []string{info.Version} for _, key := range r.Env { keys = append(keys, key) vals = append(vals, os.Getenv(key)) @@ -261,13 +276,13 @@ func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plu err = linker.DefineModule(store, "", module) linkRegion.End() if err != nil { - return nil, fmt.Errorf("define wasi: %w", err) + return fmt.Errorf("define wasi: %w", err) } // Run the function fn, err := linker.GetDefault(store, "") if err != nil { - return nil, fmt.Errorf("wasi: get default: %w", err) + return fmt.Errorf("wasi: get default: %w", err) } callRegion := trace.StartRegion(ctx, "call _start") @@ -275,17 +290,29 @@ func (r *Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plu callRegion.End() if cerr := checkError(err, stderrPath); cerr != nil { - return nil, cerr + return cerr } // Print WASM stdout stdoutBlob, err := os.ReadFile(stdoutPath) if err != nil { - return nil, fmt.Errorf("read file: %w", err) + return fmt.Errorf("read file: %w", err) } - var resp plugin.CodeGenResponse - return &resp, resp.UnmarshalVT(stdoutBlob) + resp, ok := reply.(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("reply isn't a GenerateResponse") + } + + if err := proto.Unmarshal(stdoutBlob, resp); err != nil { + return err + } + + return nil +} + +func (r *Runner) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error) { + return nil, status.Error(codes.Unimplemented, "") } func checkError(err error, stderrPath string) error { diff --git a/internal/plugin/codegen.pb.go b/internal/plugin/codegen.pb.go index 027559a216..525ffc72ef 100644 --- a/internal/plugin/codegen.pb.go +++ b/internal/plugin/codegen.pb.go @@ -961,7 +961,7 @@ func (x *Parameter) GetColumn() *Column { return nil } -type CodeGenRequest struct { +type GenerateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -974,8 +974,8 @@ type CodeGenRequest struct { GlobalOptions []byte `protobuf:"bytes,6,opt,name=global_options,proto3" json:"global_options,omitempty"` } -func (x *CodeGenRequest) Reset() { - *x = CodeGenRequest{} +func (x *GenerateRequest) Reset() { + *x = GenerateRequest{} if protoimpl.UnsafeEnabled { mi := &file_plugin_codegen_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -983,13 +983,13 @@ func (x *CodeGenRequest) Reset() { } } -func (x *CodeGenRequest) String() string { +func (x *GenerateRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CodeGenRequest) ProtoMessage() {} +func (*GenerateRequest) ProtoMessage() {} -func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { +func (x *GenerateRequest) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1001,54 +1001,54 @@ func (x *CodeGenRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CodeGenRequest.ProtoReflect.Descriptor instead. -func (*CodeGenRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead. +func (*GenerateRequest) Descriptor() ([]byte, []int) { return file_plugin_codegen_proto_rawDescGZIP(), []int{12} } -func (x *CodeGenRequest) GetSettings() *Settings { +func (x *GenerateRequest) GetSettings() *Settings { if x != nil { return x.Settings } return nil } -func (x *CodeGenRequest) GetCatalog() *Catalog { +func (x *GenerateRequest) GetCatalog() *Catalog { if x != nil { return x.Catalog } return nil } -func (x *CodeGenRequest) GetQueries() []*Query { +func (x *GenerateRequest) GetQueries() []*Query { if x != nil { return x.Queries } return nil } -func (x *CodeGenRequest) GetSqlcVersion() string { +func (x *GenerateRequest) GetSqlcVersion() string { if x != nil { return x.SqlcVersion } return "" } -func (x *CodeGenRequest) GetPluginOptions() []byte { +func (x *GenerateRequest) GetPluginOptions() []byte { if x != nil { return x.PluginOptions } return nil } -func (x *CodeGenRequest) GetGlobalOptions() []byte { +func (x *GenerateRequest) GetGlobalOptions() []byte { if x != nil { return x.GlobalOptions } return nil } -type CodeGenResponse struct { +type GenerateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1056,8 +1056,8 @@ type CodeGenResponse struct { Files []*File `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` } -func (x *CodeGenResponse) Reset() { - *x = CodeGenResponse{} +func (x *GenerateResponse) Reset() { + *x = GenerateResponse{} if protoimpl.UnsafeEnabled { mi := &file_plugin_codegen_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1065,13 +1065,13 @@ func (x *CodeGenResponse) Reset() { } } -func (x *CodeGenResponse) String() string { +func (x *GenerateResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CodeGenResponse) ProtoMessage() {} +func (*GenerateResponse) ProtoMessage() {} -func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { +func (x *GenerateResponse) ProtoReflect() protoreflect.Message { mi := &file_plugin_codegen_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1083,12 +1083,12 @@ func (x *CodeGenResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CodeGenResponse.ProtoReflect.Descriptor instead. -func (*CodeGenResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead. +func (*GenerateResponse) Descriptor() ([]byte, []int) { return file_plugin_codegen_proto_rawDescGZIP(), []int{13} } -func (x *CodeGenResponse) GetFiles() []*File { +func (x *GenerateResponse) GetFiles() []*File { if x != nil { return x.Files } @@ -1331,35 +1331,40 @@ var file_plugin_codegen_proto_rawDesc = []byte{ 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, + 0x6d, 0x6e, 0x22, 0x87, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 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, 0x36, 0x0a, 0x10, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 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, 0x32, 0x4f, 0x0a, 0x0e, 0x43, 0x6f, 0x64, 0x65, 0x67, 0x65, 0x6e, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x08, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x6c, + 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 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 ( @@ -1376,22 +1381,22 @@ func file_plugin_codegen_proto_rawDescGZIP() []byte { var file_plugin_codegen_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_plugin_codegen_proto_goTypes = []interface{}{ - (*File)(nil), // 0: plugin.File - (*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 + (*File)(nil), // 0: plugin.File + (*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 + (*GenerateRequest)(nil), // 12: plugin.GenerateRequest + (*GenerateResponse)(nil), // 13: plugin.GenerateResponse + (*Codegen_Process)(nil), // 14: plugin.Codegen.Process + (*Codegen_WASM)(nil), // 15: plugin.Codegen.WASM } var file_plugin_codegen_proto_depIdxs = []int32{ 2, // 0: plugin.Settings.codegen:type_name -> plugin.Codegen @@ -1410,12 +1415,14 @@ var file_plugin_codegen_proto_depIdxs = []int32{ 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 + 1, // 16: plugin.GenerateRequest.settings:type_name -> plugin.Settings + 3, // 17: plugin.GenerateRequest.catalog:type_name -> plugin.Catalog + 10, // 18: plugin.GenerateRequest.queries:type_name -> plugin.Query + 0, // 19: plugin.GenerateResponse.files:type_name -> plugin.File + 12, // 20: plugin.CodegenService.Generate:input_type -> plugin.GenerateRequest + 13, // 21: plugin.CodegenService.Generate:output_type -> plugin.GenerateResponse + 21, // [21:22] is the sub-list for method output_type + 20, // [20:21] 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 @@ -1572,7 +1579,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenRequest); i { + switch v := v.(*GenerateRequest); i { case 0: return &v.state case 1: @@ -1584,7 +1591,7 @@ func file_plugin_codegen_proto_init() { } } file_plugin_codegen_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeGenResponse); i { + switch v := v.(*GenerateResponse); i { case 0: return &v.state case 1: @@ -1628,7 +1635,7 @@ func file_plugin_codegen_proto_init() { NumEnums: 0, NumMessages: 16, NumExtensions: 0, - NumServices: 0, + NumServices: 1, }, GoTypes: file_plugin_codegen_proto_goTypes, DependencyIndexes: file_plugin_codegen_proto_depIdxs, diff --git a/internal/plugin/codegen_grpc.pb.go b/internal/plugin/codegen_grpc.pb.go new file mode 100644 index 0000000000..30287ac457 --- /dev/null +++ b/internal/plugin/codegen_grpc.pb.go @@ -0,0 +1,109 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: plugin/codegen.proto + +package plugin + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + CodegenService_Generate_FullMethodName = "/plugin.CodegenService/Generate" +) + +// CodegenServiceClient is the client API for CodegenService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CodegenServiceClient interface { + Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) +} + +type codegenServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCodegenServiceClient(cc grpc.ClientConnInterface) CodegenServiceClient { + return &codegenServiceClient{cc} +} + +func (c *codegenServiceClient) Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error) { + out := new(GenerateResponse) + err := c.cc.Invoke(ctx, CodegenService_Generate_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CodegenServiceServer is the server API for CodegenService service. +// All implementations must embed UnimplementedCodegenServiceServer +// for forward compatibility +type CodegenServiceServer interface { + Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) + mustEmbedUnimplementedCodegenServiceServer() +} + +// UnimplementedCodegenServiceServer must be embedded to have forward compatible implementations. +type UnimplementedCodegenServiceServer struct { +} + +func (UnimplementedCodegenServiceServer) Generate(context.Context, *GenerateRequest) (*GenerateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") +} +func (UnimplementedCodegenServiceServer) mustEmbedUnimplementedCodegenServiceServer() {} + +// UnsafeCodegenServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CodegenServiceServer will +// result in compilation errors. +type UnsafeCodegenServiceServer interface { + mustEmbedUnimplementedCodegenServiceServer() +} + +func RegisterCodegenServiceServer(s grpc.ServiceRegistrar, srv CodegenServiceServer) { + s.RegisterService(&CodegenService_ServiceDesc, srv) +} + +func _CodegenService_Generate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CodegenServiceServer).Generate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CodegenService_Generate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CodegenServiceServer).Generate(ctx, req.(*GenerateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CodegenService_ServiceDesc is the grpc.ServiceDesc for CodegenService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CodegenService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plugin.CodegenService", + HandlerType: (*CodegenServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Generate", + Handler: _CodegenService_Generate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/codegen.proto", +} diff --git a/internal/plugin/codegen_vtproto.pb.go b/internal/plugin/codegen_vtproto.pb.go deleted file mode 100644 index 26e558ee8e..0000000000 --- a/internal/plugin/codegen_vtproto.pb.go +++ /dev/null @@ -1,6840 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.4.0 -// source: plugin/codegen.proto - -package plugin - -import ( - fmt "fmt" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - io "io" - bits "math/bits" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -func (m *File) CloneVT() *File { - if m == nil { - return (*File)(nil) - } - r := &File{ - Name: m.Name, - } - if rhs := m.Contents; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Contents = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *File) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Settings) CloneVT() *Settings { - if m == nil { - return (*Settings)(nil) - } - r := &Settings{ - Version: m.Version, - Engine: m.Engine, - Codegen: m.Codegen.CloneVT(), - } - if rhs := m.Schema; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Schema = tmpContainer - } - if rhs := m.Queries; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Queries = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Settings) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen_Process) CloneVT() *Codegen_Process { - if m == nil { - return (*Codegen_Process)(nil) - } - r := &Codegen_Process{ - Cmd: m.Cmd, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen_Process) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen_WASM) CloneVT() *Codegen_WASM { - if m == nil { - return (*Codegen_WASM)(nil) - } - r := &Codegen_WASM{ - Url: m.Url, - Sha256: m.Sha256, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen_WASM) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Codegen) CloneVT() *Codegen { - if m == nil { - return (*Codegen)(nil) - } - r := &Codegen{ - Out: m.Out, - Plugin: m.Plugin, - Process: m.Process.CloneVT(), - Wasm: m.Wasm.CloneVT(), - } - if rhs := m.Options; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Options = tmpBytes - } - if rhs := m.Env; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Env = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Codegen) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Catalog) CloneVT() *Catalog { - if m == nil { - return (*Catalog)(nil) - } - r := &Catalog{ - Comment: m.Comment, - DefaultSchema: m.DefaultSchema, - Name: m.Name, - } - if rhs := m.Schemas; rhs != nil { - tmpContainer := make([]*Schema, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Schemas = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Catalog) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Schema) CloneVT() *Schema { - if m == nil { - return (*Schema)(nil) - } - r := &Schema{ - Comment: m.Comment, - Name: m.Name, - } - if rhs := m.Tables; rhs != nil { - tmpContainer := make([]*Table, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Tables = tmpContainer - } - if rhs := m.Enums; rhs != nil { - tmpContainer := make([]*Enum, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Enums = tmpContainer - } - if rhs := m.CompositeTypes; rhs != nil { - tmpContainer := make([]*CompositeType, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.CompositeTypes = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Schema) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CompositeType) CloneVT() *CompositeType { - if m == nil { - return (*CompositeType)(nil) - } - r := &CompositeType{ - Name: m.Name, - Comment: m.Comment, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CompositeType) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Enum) CloneVT() *Enum { - if m == nil { - return (*Enum)(nil) - } - r := &Enum{ - Name: m.Name, - Comment: m.Comment, - } - if rhs := m.Vals; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Vals = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Enum) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Table) CloneVT() *Table { - if m == nil { - return (*Table)(nil) - } - r := &Table{ - Rel: m.Rel.CloneVT(), - Comment: m.Comment, - } - if rhs := m.Columns; rhs != nil { - tmpContainer := make([]*Column, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Columns = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Table) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Identifier) CloneVT() *Identifier { - if m == nil { - return (*Identifier)(nil) - } - r := &Identifier{ - Catalog: m.Catalog, - Schema: m.Schema, - Name: m.Name, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Identifier) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Column) CloneVT() *Column { - if m == nil { - return (*Column)(nil) - } - r := &Column{ - Name: m.Name, - NotNull: m.NotNull, - IsArray: m.IsArray, - Comment: m.Comment, - Length: m.Length, - IsNamedParam: m.IsNamedParam, - IsFuncCall: m.IsFuncCall, - Scope: m.Scope, - Table: m.Table.CloneVT(), - TableAlias: m.TableAlias, - Type: m.Type.CloneVT(), - IsSqlcSlice: m.IsSqlcSlice, - EmbedTable: m.EmbedTable.CloneVT(), - OriginalName: m.OriginalName, - Unsigned: m.Unsigned, - ArrayDims: m.ArrayDims, - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Column) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Query) CloneVT() *Query { - if m == nil { - return (*Query)(nil) - } - r := &Query{ - Text: m.Text, - Name: m.Name, - Cmd: m.Cmd, - Filename: m.Filename, - InsertIntoTable: m.InsertIntoTable.CloneVT(), - } - if rhs := m.Columns; rhs != nil { - tmpContainer := make([]*Column, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Columns = tmpContainer - } - if rhs := m.Params; rhs != nil { - tmpContainer := make([]*Parameter, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Params = tmpContainer - } - if rhs := m.Comments; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Comments = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Query) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Parameter) CloneVT() *Parameter { - if m == nil { - return (*Parameter)(nil) - } - r := &Parameter{ - Number: m.Number, - Column: m.Column.CloneVT(), - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Parameter) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CodeGenRequest) CloneVT() *CodeGenRequest { - if m == nil { - return (*CodeGenRequest)(nil) - } - r := &CodeGenRequest{ - Settings: m.Settings.CloneVT(), - Catalog: m.Catalog.CloneVT(), - SqlcVersion: m.SqlcVersion, - } - if rhs := m.Queries; rhs != nil { - tmpContainer := make([]*Query, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Queries = tmpContainer - } - if rhs := m.PluginOptions; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - 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) - } - return r -} - -func (m *CodeGenRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *CodeGenResponse) CloneVT() *CodeGenResponse { - if m == nil { - return (*CodeGenResponse)(nil) - } - r := &CodeGenResponse{} - if rhs := m.Files; rhs != nil { - tmpContainer := make([]*File, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Files = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *CodeGenResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *File) EqualVT(that *File) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if string(this.Contents) != string(that.Contents) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *File) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*File) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Settings) EqualVT(that *Settings) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Version != that.Version { - return false - } - if this.Engine != that.Engine { - return false - } - if len(this.Schema) != len(that.Schema) { - return false - } - for i, vx := range this.Schema { - vy := that.Schema[i] - if vx != vy { - return false - } - } - if len(this.Queries) != len(that.Queries) { - return false - } - for i, vx := range this.Queries { - vy := that.Queries[i] - if vx != vy { - return false - } - } - if !this.Codegen.EqualVT(that.Codegen) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Settings) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Settings) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen_Process) EqualVT(that *Codegen_Process) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Cmd != that.Cmd { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen_Process) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen_Process) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen_WASM) EqualVT(that *Codegen_WASM) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Url != that.Url { - return false - } - if this.Sha256 != that.Sha256 { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen_WASM) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen_WASM) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Codegen) EqualVT(that *Codegen) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Out != that.Out { - return false - } - if this.Plugin != that.Plugin { - return false - } - if string(this.Options) != string(that.Options) { - return false - } - if len(this.Env) != len(that.Env) { - return false - } - for i, vx := range this.Env { - vy := that.Env[i] - if vx != vy { - return false - } - } - if !this.Process.EqualVT(that.Process) { - return false - } - if !this.Wasm.EqualVT(that.Wasm) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Codegen) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Codegen) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Catalog) EqualVT(that *Catalog) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Comment != that.Comment { - return false - } - if this.DefaultSchema != that.DefaultSchema { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Schemas) != len(that.Schemas) { - return false - } - for i, vx := range this.Schemas { - vy := that.Schemas[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Schema{} - } - if q == nil { - q = &Schema{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Catalog) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Catalog) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Schema) EqualVT(that *Schema) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Comment != that.Comment { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Tables) != len(that.Tables) { - return false - } - for i, vx := range this.Tables { - vy := that.Tables[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Table{} - } - if q == nil { - q = &Table{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Enums) != len(that.Enums) { - return false - } - for i, vx := range this.Enums { - vy := that.Enums[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Enum{} - } - if q == nil { - q = &Enum{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.CompositeTypes) != len(that.CompositeTypes) { - return false - } - for i, vx := range this.CompositeTypes { - vy := that.CompositeTypes[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &CompositeType{} - } - if q == nil { - q = &CompositeType{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Schema) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Schema) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CompositeType) EqualVT(that *CompositeType) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CompositeType) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CompositeType) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Enum) EqualVT(that *Enum) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if len(this.Vals) != len(that.Vals) { - return false - } - for i, vx := range this.Vals { - vy := that.Vals[i] - if vx != vy { - return false - } - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Enum) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Enum) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Table) EqualVT(that *Table) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.Rel.EqualVT(that.Rel) { - return false - } - if len(this.Columns) != len(that.Columns) { - return false - } - for i, vx := range this.Columns { - vy := that.Columns[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Column{} - } - if q == nil { - q = &Column{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.Comment != that.Comment { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Table) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Table) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Identifier) EqualVT(that *Identifier) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Catalog != that.Catalog { - return false - } - if this.Schema != that.Schema { - return false - } - if this.Name != that.Name { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Identifier) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Identifier) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Column) EqualVT(that *Column) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Name != that.Name { - return false - } - if this.NotNull != that.NotNull { - return false - } - if this.IsArray != that.IsArray { - return false - } - if this.Comment != that.Comment { - return false - } - if this.Length != that.Length { - return false - } - if this.IsNamedParam != that.IsNamedParam { - return false - } - if this.IsFuncCall != that.IsFuncCall { - return false - } - if this.Scope != that.Scope { - return false - } - if !this.Table.EqualVT(that.Table) { - return false - } - if this.TableAlias != that.TableAlias { - return false - } - if !this.Type.EqualVT(that.Type) { - return false - } - if this.IsSqlcSlice != that.IsSqlcSlice { - return false - } - if !this.EmbedTable.EqualVT(that.EmbedTable) { - return false - } - if this.OriginalName != that.OriginalName { - return false - } - if this.Unsigned != that.Unsigned { - return false - } - if this.ArrayDims != that.ArrayDims { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Column) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Column) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Query) EqualVT(that *Query) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Text != that.Text { - return false - } - if this.Name != that.Name { - return false - } - if this.Cmd != that.Cmd { - return false - } - if len(this.Columns) != len(that.Columns) { - return false - } - for i, vx := range this.Columns { - vy := that.Columns[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Column{} - } - if q == nil { - q = &Column{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Params) != len(that.Params) { - return false - } - for i, vx := range this.Params { - vy := that.Params[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Parameter{} - } - if q == nil { - q = &Parameter{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Comments) != len(that.Comments) { - return false - } - for i, vx := range this.Comments { - vy := that.Comments[i] - if vx != vy { - return false - } - } - if this.Filename != that.Filename { - return false - } - if !this.InsertIntoTable.EqualVT(that.InsertIntoTable) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Query) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Query) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Parameter) EqualVT(that *Parameter) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Number != that.Number { - return false - } - if !this.Column.EqualVT(that.Column) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Parameter) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Parameter) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CodeGenRequest) EqualVT(that *CodeGenRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.Settings.EqualVT(that.Settings) { - return false - } - if !this.Catalog.EqualVT(that.Catalog) { - return false - } - if len(this.Queries) != len(that.Queries) { - return false - } - for i, vx := range this.Queries { - vy := that.Queries[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &Query{} - } - if q == nil { - q = &Query{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.SqlcVersion != that.SqlcVersion { - return false - } - 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) -} - -func (this *CodeGenRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CodeGenRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *CodeGenResponse) EqualVT(that *CodeGenResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Files) != len(that.Files) { - return false - } - for i, vx := range this.Files { - vy := that.Files[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &File{} - } - if q == nil { - q = &File{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *CodeGenResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*CodeGenResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *File) 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 *File) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *File) 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.Contents) > 0 { - i -= len(m.Contents) - copy(dAtA[i:], m.Contents) - i = encodeVarint(dAtA, i, uint64(len(m.Contents))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Settings) 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 *Settings) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Settings) 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.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] = 0x62 - } - 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 - } - if m.Process != nil { - size, err := m.Process.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if len(m.Env) > 0 { - for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Env[iNdEx]) - copy(dAtA[i:], m.Env[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Env[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarint(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x1a - } - if len(m.Plugin) > 0 { - i -= len(m.Plugin) - copy(dAtA[i:], m.Plugin) - i = encodeVarint(dAtA, i, uint64(len(m.Plugin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Catalog) 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 *Catalog) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Catalog) 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.Schemas) > 0 { - for iNdEx := len(m.Schemas) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Schemas[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DefaultSchema) > 0 { - i -= len(m.DefaultSchema) - copy(dAtA[i:], m.DefaultSchema) - i = encodeVarint(dAtA, i, uint64(len(m.DefaultSchema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) 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 *Schema) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Schema) 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.CompositeTypes) > 0 { - for iNdEx := len(m.CompositeTypes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.CompositeTypes[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Enums) > 0 { - for iNdEx := len(m.Enums) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Enums[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Tables) > 0 { - for iNdEx := len(m.Tables) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Tables[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompositeType) 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 *CompositeType) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CompositeType) 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.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Enum) 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 *Enum) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Enum) 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.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Vals) > 0 { - for iNdEx := len(m.Vals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Vals[iNdEx]) - copy(dAtA[i:], m.Vals[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Vals[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Table) 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 *Table) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Table) 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.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.Rel != nil { - size, err := m.Rel.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Identifier) 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 *Identifier) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Identifier) 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.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarint(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Catalog) > 0 { - i -= len(m.Catalog) - copy(dAtA[i:], m.Catalog) - i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Column) 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 *Column) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Column) 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.ArrayDims != 0 { - i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.OriginalName) > 0 { - i -= len(m.OriginalName) - copy(dAtA[i:], m.OriginalName) - i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) - i-- - dAtA[i] = 0x7a - } - if m.EmbedTable != nil { - size, err := m.EmbedTable.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.IsSqlcSlice { - i-- - if m.IsSqlcSlice { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.Type != nil { - size, err := m.Type.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.TableAlias) > 0 { - i -= len(m.TableAlias) - copy(dAtA[i:], m.TableAlias) - i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) - i-- - dAtA[i] = 0x5a - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Scope) > 0 { - i -= len(m.Scope) - copy(dAtA[i:], m.Scope) - i = encodeVarint(dAtA, i, uint64(len(m.Scope))) - i-- - dAtA[i] = 0x4a - } - if m.IsFuncCall { - i-- - if m.IsFuncCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.IsNamedParam { - i-- - if m.IsNamedParam { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Length != 0 { - i = encodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x30 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x2a - } - if m.IsArray { - i-- - if m.IsArray { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NotNull { - i-- - if m.NotNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Query) 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 *Query) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Query) 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.InsertIntoTable != nil { - size, err := m.InsertIntoTable.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x3a - } - if len(m.Comments) > 0 { - for iNdEx := len(m.Comments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Comments[iNdEx]) - copy(dAtA[i:], m.Comments[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Comments[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Params) > 0 { - for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Params[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - 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] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Text) > 0 { - i -= len(m.Text) - copy(dAtA[i:], m.Text) - i = encodeVarint(dAtA, i, uint64(len(m.Text))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Parameter) 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 *Parameter) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Parameter) 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.Column != nil { - size, err := m.Column.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Number != 0 { - i = encodeVarint(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CodeGenRequest) 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 *CodeGenRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CodeGenRequest) 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.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) - i = encodeVarint(dAtA, i, uint64(len(m.PluginOptions))) - i-- - dAtA[i] = 0x2a - } - if len(m.SqlcVersion) > 0 { - i -= len(m.SqlcVersion) - copy(dAtA[i:], m.SqlcVersion) - i = encodeVarint(dAtA, i, uint64(len(m.SqlcVersion))) - i-- - dAtA[i] = 0x22 - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Queries[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.Catalog != nil { - size, err := m.Catalog.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Settings != nil { - size, err := m.Settings.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CodeGenResponse) 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 *CodeGenResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *CodeGenResponse) 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.Files) > 0 { - for iNdEx := len(m.Files) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Files[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarint(dAtA []byte, offset int, v uint64) int { - offset -= sov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *File) 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 *File) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *File) 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.Contents) > 0 { - i -= len(m.Contents) - copy(dAtA[i:], m.Contents) - i = encodeVarint(dAtA, i, uint64(len(m.Contents))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - 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.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))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Codegen_WASM) 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_WASM) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen_WASM) 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.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) 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) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Codegen) 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.Wasm != nil { - size, err := m.Wasm.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x32 - } - if m.Process != nil { - size, err := m.Process.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if len(m.Env) > 0 { - for iNdEx := len(m.Env) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Env[iNdEx]) - copy(dAtA[i:], m.Env[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Env[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarint(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x1a - } - if len(m.Plugin) > 0 { - i -= len(m.Plugin) - copy(dAtA[i:], m.Plugin) - i = encodeVarint(dAtA, i, uint64(len(m.Plugin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Out) > 0 { - i -= len(m.Out) - copy(dAtA[i:], m.Out) - i = encodeVarint(dAtA, i, uint64(len(m.Out))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Catalog) 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 *Catalog) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Catalog) 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.Schemas) > 0 { - for iNdEx := len(m.Schemas) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Schemas[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DefaultSchema) > 0 { - i -= len(m.DefaultSchema) - copy(dAtA[i:], m.DefaultSchema) - i = encodeVarint(dAtA, i, uint64(len(m.DefaultSchema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Schema) 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 *Schema) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Schema) 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.CompositeTypes) > 0 { - for iNdEx := len(m.CompositeTypes) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.CompositeTypes[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Enums) > 0 { - for iNdEx := len(m.Enums) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Enums[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - if len(m.Tables) > 0 { - for iNdEx := len(m.Tables) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Tables[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompositeType) 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 *CompositeType) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CompositeType) 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.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Enum) 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 *Enum) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Enum) 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.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Vals) > 0 { - for iNdEx := len(m.Vals) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Vals[iNdEx]) - copy(dAtA[i:], m.Vals[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Vals[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Table) 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 *Table) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Table) 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.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x1a - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - } - if m.Rel != nil { - size, err := m.Rel.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Identifier) 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 *Identifier) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Identifier) 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.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarint(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x12 - } - if len(m.Catalog) > 0 { - i -= len(m.Catalog) - copy(dAtA[i:], m.Catalog) - i = encodeVarint(dAtA, i, uint64(len(m.Catalog))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Column) 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 *Column) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Column) 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.ArrayDims != 0 { - i = encodeVarint(dAtA, i, uint64(m.ArrayDims)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.Unsigned { - i-- - if m.Unsigned { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if len(m.OriginalName) > 0 { - i -= len(m.OriginalName) - copy(dAtA[i:], m.OriginalName) - i = encodeVarint(dAtA, i, uint64(len(m.OriginalName))) - i-- - dAtA[i] = 0x7a - } - if m.EmbedTable != nil { - size, err := m.EmbedTable.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x72 - } - if m.IsSqlcSlice { - i-- - if m.IsSqlcSlice { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.Type != nil { - size, err := m.Type.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x62 - } - if len(m.TableAlias) > 0 { - i -= len(m.TableAlias) - copy(dAtA[i:], m.TableAlias) - i = encodeVarint(dAtA, i, uint64(len(m.TableAlias))) - i-- - dAtA[i] = 0x5a - } - if m.Table != nil { - size, err := m.Table.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x52 - } - if len(m.Scope) > 0 { - i -= len(m.Scope) - copy(dAtA[i:], m.Scope) - i = encodeVarint(dAtA, i, uint64(len(m.Scope))) - i-- - dAtA[i] = 0x4a - } - if m.IsFuncCall { - i-- - if m.IsFuncCall { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.IsNamedParam { - i-- - if m.IsNamedParam { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Length != 0 { - i = encodeVarint(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x30 - } - if len(m.Comment) > 0 { - i -= len(m.Comment) - copy(dAtA[i:], m.Comment) - i = encodeVarint(dAtA, i, uint64(len(m.Comment))) - i-- - dAtA[i] = 0x2a - } - if m.IsArray { - i-- - if m.IsArray { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NotNull { - i-- - if m.NotNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Query) 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 *Query) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Query) 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.InsertIntoTable != nil { - size, err := m.InsertIntoTable.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x42 - } - if len(m.Filename) > 0 { - i -= len(m.Filename) - copy(dAtA[i:], m.Filename) - i = encodeVarint(dAtA, i, uint64(len(m.Filename))) - i-- - dAtA[i] = 0x3a - } - if len(m.Comments) > 0 { - for iNdEx := len(m.Comments) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Comments[iNdEx]) - copy(dAtA[i:], m.Comments[iNdEx]) - i = encodeVarint(dAtA, i, uint64(len(m.Comments[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.Params) > 0 { - for iNdEx := len(m.Params) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Params[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - } - if len(m.Columns) > 0 { - for iNdEx := len(m.Columns) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Columns[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - } - 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] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarint(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Text) > 0 { - i -= len(m.Text) - copy(dAtA[i:], m.Text) - i = encodeVarint(dAtA, i, uint64(len(m.Text))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Parameter) 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 *Parameter) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *Parameter) 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.Column != nil { - size, err := m.Column.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Number != 0 { - i = encodeVarint(dAtA, i, uint64(m.Number)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *CodeGenRequest) 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 *CodeGenRequest) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CodeGenRequest) 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.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) - i = encodeVarint(dAtA, i, uint64(len(m.PluginOptions))) - i-- - dAtA[i] = 0x2a - } - if len(m.SqlcVersion) > 0 { - i -= len(m.SqlcVersion) - copy(dAtA[i:], m.SqlcVersion) - i = encodeVarint(dAtA, i, uint64(len(m.SqlcVersion))) - i-- - dAtA[i] = 0x22 - } - if len(m.Queries) > 0 { - for iNdEx := len(m.Queries) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Queries[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - } - if m.Catalog != nil { - size, err := m.Catalog.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.Settings != nil { - size, err := m.Settings.MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CodeGenResponse) 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 *CodeGenResponse) MarshalToVTStrict(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVTStrict(dAtA[:size]) -} - -func (m *CodeGenResponse) 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.Files) > 0 { - for iNdEx := len(m.Files) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Files[iNdEx].MarshalToSizedBufferVTStrict(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *File) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Contents) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Settings) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Version) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Engine) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Schema) > 0 { - for _, s := range m.Schema { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Queries) > 0 { - for _, s := range m.Queries { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if m.Codegen != nil { - l = m.Codegen.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen_Process) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Cmd) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen_WASM) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Url) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Sha256) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Codegen) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Out) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Plugin) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Options) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Env) > 0 { - for _, s := range m.Env { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - if m.Process != nil { - l = m.Process.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.Wasm != nil { - l = m.Wasm.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Catalog) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.DefaultSchema) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Schemas) > 0 { - for _, e := range m.Schemas { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Schema) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Tables) > 0 { - for _, e := range m.Tables { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Enums) > 0 { - for _, e := range m.Enums { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.CompositeTypes) > 0 { - for _, e := range m.CompositeTypes { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *CompositeType) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Enum) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Vals) > 0 { - for _, s := range m.Vals { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Table) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Rel != nil { - l = m.Rel.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Identifier) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Catalog) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Schema) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Column) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.NotNull { - n += 2 - } - if m.IsArray { - n += 2 - } - l = len(m.Comment) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Length != 0 { - n += 1 + sov(uint64(m.Length)) - } - if m.IsNamedParam { - n += 2 - } - if m.IsFuncCall { - n += 2 - } - l = len(m.Scope) - 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.TableAlias) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Type != nil { - l = m.Type.SizeVT() - n += 1 + l + sov(uint64(l)) - } - if m.IsSqlcSlice { - n += 2 - } - if m.EmbedTable != nil { - l = m.EmbedTable.SizeVT() - n += 1 + l + sov(uint64(l)) - } - l = len(m.OriginalName) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.Unsigned { - n += 3 - } - if m.ArrayDims != 0 { - n += 2 + sov(uint64(m.ArrayDims)) - } - n += len(m.unknownFields) - return n -} - -func (m *Query) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Text) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - l = len(m.Cmd) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Params) > 0 { - for _, e := range m.Params { - l = e.SizeVT() - n += 1 + l + sov(uint64(l)) - } - } - if len(m.Comments) > 0 { - for _, s := range m.Comments { - l = len(s) - n += 1 + l + sov(uint64(l)) - } - } - l = len(m.Filename) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } - if m.InsertIntoTable != nil { - l = m.InsertIntoTable.SizeVT() - n += 1 + l + sov(uint64(l)) - } - n += len(m.unknownFields) - 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)) - } - l = len(m.GlobalOptions) - 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 *Settings) 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: Settings: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Settings: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", 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.Version = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Engine", 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.Engine = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", 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.Schema = append(m.Schema, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Queries", 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.Queries = append(m.Queries, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Codegen", 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.Codegen == nil { - m.Codegen = &Codegen{} - } - if err := m.Codegen.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Codegen_Process) 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: Codegen_Process: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen_Process: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cmd", 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.Cmd = string(dAtA[iNdEx:postIndex]) - 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 *Codegen_WASM) 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: Codegen_WASM: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen_WASM: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Url", 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.Url = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sha256", 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.Sha256 = string(dAtA[iNdEx:postIndex]) - 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 *Codegen) 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: Codegen: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Codegen: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Out", 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.Out = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Plugin", 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.Plugin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = append(m.Options[:0], dAtA[iNdEx:postIndex]...) - if m.Options == nil { - m.Options = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Env", 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.Env = append(m.Env, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Process", 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.Process == nil { - m.Process = &Codegen_Process{} - } - if err := m.Process.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Wasm", 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.Wasm == nil { - m.Wasm = &Codegen_WASM{} - } - if err := m.Wasm.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Catalog) 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: Catalog: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Catalog: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", 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.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultSchema", 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.DefaultSchema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemas", 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.Schemas = append(m.Schemas, &Schema{}) - if err := m.Schemas[len(m.Schemas)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Schema) 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: Schema: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Schema: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", 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.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tables", 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.Tables = append(m.Tables, &Table{}) - if err := m.Tables[len(m.Tables)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Enums", 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.Enums = append(m.Enums, &Enum{}) - if err := m.Enums[len(m.Enums)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompositeTypes", 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.CompositeTypes = append(m.CompositeTypes, &CompositeType{}) - if err := m.CompositeTypes[len(m.CompositeTypes)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompositeType) 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: CompositeType: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompositeType: 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 Comment", 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.Comment = string(dAtA[iNdEx:postIndex]) - 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 *Enum) 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: Enum: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Enum: 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 Vals", 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.Vals = append(m.Vals, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", 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.Comment = string(dAtA[iNdEx:postIndex]) - 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 *Table) 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: Table: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Table: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rel", 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.Rel == nil { - m.Rel = &Identifier{} - } - if err := m.Rel.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", 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.Columns = append(m.Columns, &Column{}) - if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", 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.Comment = string(dAtA[iNdEx:postIndex]) - 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 *Identifier) 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: Identifier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Identifier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Catalog", 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.Catalog = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", 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.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 - 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 *Column) 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: Column: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Column: 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 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NotNull", 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.NotNull = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsArray", 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.IsArray = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", 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.Comment = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsNamedParam", 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.IsNamedParam = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsFuncCall", 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.IsFuncCall = bool(v != 0) - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scope", 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.Scope = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - 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 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TableAlias", 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.TableAlias = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", 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.Type == nil { - m.Type = &Identifier{} - } - if err := m.Type.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsSqlcSlice", 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.IsSqlcSlice = bool(v != 0) - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EmbedTable", 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.EmbedTable == nil { - m.EmbedTable = &Identifier{} - } - if err := m.EmbedTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginalName", 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.OriginalName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - 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) - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ArrayDims", wireType) - } - m.ArrayDims = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ArrayDims |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *Query) 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: Query: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Query: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", 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.Text = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cmd", 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.Cmd = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", 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.Columns = append(m.Columns, &Column{}) - if err := m.Columns[len(m.Columns)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params = append(m.Params, &Parameter{}) - if err := m.Params[len(m.Params)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comments", 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.Comments = append(m.Comments, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filename", 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.Filename = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InsertIntoTable", 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.InsertIntoTable == nil { - m.InsertIntoTable = &Identifier{} - } - if err := m.InsertIntoTable.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Parameter) 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: Parameter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Parameter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Number", wireType) - } - m.Number = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Number |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", 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.Column == nil { - m.Column = &Column{} - } - if err := m.Column.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CodeGenRequest) 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: CodeGenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CodeGenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Settings", 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.Settings == nil { - m.Settings = &Settings{} - } - if err := m.Settings.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Catalog", 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.Catalog == nil { - m.Catalog = &Catalog{} - } - if err := m.Catalog.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Queries", 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.Queries = append(m.Queries, &Query{}) - if err := m.Queries[len(m.Queries)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlcVersion", 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.SqlcVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PluginOptions", 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.PluginOptions = append(m.PluginOptions[:0], dAtA[iNdEx:postIndex]...) - if m.PluginOptions == nil { - 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:]) - 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 *CodeGenResponse) 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: CodeGenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CodeGenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Files", 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.Files = append(m.Files, &File{}) - if err := m.Files[len(m.Files)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} - -func skip(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflow - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLength - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroup - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLength - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflow = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") -) diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index 1d0355cb20..aac65af356 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -4,6 +4,10 @@ package plugin; option go_package = "github.com/sqlc-dev/sqlc/internal/plugin"; +service CodegenService { + rpc Generate (GenerateRequest) returns (GenerateResponse); +} + message File { string name = 1 [json_name = "name"]; bytes contents = 2 [json_name = "contents"]; @@ -116,7 +120,7 @@ message Parameter { Column column = 2 [json_name = "column"]; } -message CodeGenRequest { +message GenerateRequest { Settings settings = 1 [json_name = "settings"]; Catalog catalog = 2 [json_name = "catalog"]; repeated Query queries = 3 [json_name = "queries"]; @@ -125,6 +129,6 @@ message CodeGenRequest { bytes global_options = 6 [json_name = "global_options"]; } -message CodeGenResponse { +message GenerateResponse { repeated File files = 1 [json_name = "files"]; }