From 1c8a2d90691aeff38a5baa51b6d3edc4acd9566e Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 27 Apr 2022 18:24:42 -0400 Subject: [PATCH] feat(cli): dynamically generate query CLI commands (#11725) * WIP on auto-generating CLi * WIP * WIP * WIP * add pagination.go * handle more flag types * WIP on refactoring * WIP * working tests * add docs * echo all flags * add repeated tests * remove comment * fix compositeListValue issue Co-authored-by: Anil Kumar Kammari Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- client/v2/Makefile | 2 + client/v2/cli/builder.go | 20 + client/v2/cli/flag/address.go | 40 + client/v2/cli/flag/builder.go | 47 + client/v2/cli/flag/duration.go | 52 + client/v2/cli/flag/enum.go | 74 + client/v2/cli/flag/field.go | 129 + client/v2/cli/flag/list.go | 107 + client/v2/cli/flag/message.go | 64 + client/v2/cli/flag/pagination.go | 20 + client/v2/cli/flag/register.go | 59 + client/v2/cli/flag/simple.go | 54 + client/v2/cli/flag/timestamp.go | 51 + client/v2/cli/flag/type.go | 18 + client/v2/cli/flag/value.go | 19 + client/v2/cli/query.go | 87 + client/v2/cli/query_test.go | 117 + client/v2/cli/testdata/help.golden | 29 + client/v2/go.mod | 26 + client/v2/go.sum | 181 + client/v2/internal/buf.gen.yaml | 16 + client/v2/internal/buf.lock | 23 + client/v2/internal/buf.yaml | 12 + client/v2/internal/testpb/query.proto | 55 + client/v2/internal/testpb/query.pulsar.go | 3631 ++++++++++++++++++++ client/v2/internal/testpb/query_grpc.pb.go | 107 + client/v2/internal/util/util.go | 29 + 27 files changed, 5069 insertions(+) create mode 100644 client/v2/Makefile create mode 100644 client/v2/cli/builder.go create mode 100644 client/v2/cli/flag/address.go create mode 100644 client/v2/cli/flag/builder.go create mode 100644 client/v2/cli/flag/duration.go create mode 100644 client/v2/cli/flag/enum.go create mode 100644 client/v2/cli/flag/field.go create mode 100644 client/v2/cli/flag/list.go create mode 100644 client/v2/cli/flag/message.go create mode 100644 client/v2/cli/flag/pagination.go create mode 100644 client/v2/cli/flag/register.go create mode 100644 client/v2/cli/flag/simple.go create mode 100644 client/v2/cli/flag/timestamp.go create mode 100644 client/v2/cli/flag/type.go create mode 100644 client/v2/cli/flag/value.go create mode 100644 client/v2/cli/query.go create mode 100644 client/v2/cli/query_test.go create mode 100644 client/v2/cli/testdata/help.golden create mode 100644 client/v2/go.mod create mode 100644 client/v2/go.sum create mode 100644 client/v2/internal/buf.gen.yaml create mode 100644 client/v2/internal/buf.lock create mode 100644 client/v2/internal/buf.yaml create mode 100644 client/v2/internal/testpb/query.proto create mode 100644 client/v2/internal/testpb/query.pulsar.go create mode 100644 client/v2/internal/testpb/query_grpc.pb.go create mode 100644 client/v2/internal/util/util.go diff --git a/client/v2/Makefile b/client/v2/Makefile new file mode 100644 index 0000000000..6868d1941a --- /dev/null +++ b/client/v2/Makefile @@ -0,0 +1,2 @@ +codegen: + @(cd internal; buf generate) diff --git a/client/v2/cli/builder.go b/client/v2/cli/builder.go new file mode 100644 index 0000000000..ecc4b0c9c0 --- /dev/null +++ b/client/v2/cli/builder.go @@ -0,0 +1,20 @@ +package cli + +import ( + "context" + + "google.golang.org/grpc" + + "github.com/cosmos/cosmos-sdk/client/v2/cli/flag" +) + +// Builder manages options for building CLI commands. +type Builder struct { + + // flag.Builder embeds the flag builder and its options. + flag.Builder + + // GetClientConn specifies how CLI commands will resolve a grpc.ClientConnInterface + // from a given context. + GetClientConn func(context.Context) grpc.ClientConnInterface +} diff --git a/client/v2/cli/flag/address.go b/client/v2/cli/flag/address.go new file mode 100644 index 0000000000..f2008e4b32 --- /dev/null +++ b/client/v2/cli/flag/address.go @@ -0,0 +1,40 @@ +package flag + +import ( + "context" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type addressStringType struct{} + +func (a addressStringType) NewValue(_ context.Context, _ *Builder) pflag.Value { + return &addressValue{} +} + +func (a addressStringType) DefaultValue() string { + return "" +} + +type addressValue struct { + value string +} + +func (a addressValue) Get() protoreflect.Value { + return protoreflect.ValueOfString(a.value) +} + +func (a addressValue) String() string { + return a.value +} + +func (a *addressValue) Set(s string) error { + a.value = s + // TODO handle bech32 validation + return nil +} + +func (a addressValue) Type() string { + return "bech32 account address key name" +} diff --git a/client/v2/cli/flag/builder.go b/client/v2/cli/flag/builder.go new file mode 100644 index 0000000000..2969314e84 --- /dev/null +++ b/client/v2/cli/flag/builder.go @@ -0,0 +1,47 @@ +package flag + +import ( + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" +) + +// Builder manages options for building pflag flags for protobuf messages. +type Builder struct { + // TypeResolver specifies how protobuf types will be resolved. If it is + // nil protoregistry.GlobalTypes will be used. + TypeResolver interface { + protoregistry.MessageTypeResolver + protoregistry.ExtensionTypeResolver + } + + // FileResolver specifies how protobuf file descriptors will be resolved. If it is + // nil protoregistry.GlobalFiles will be used. + FileResolver protodesc.Resolver + + messageFlagTypes map[protoreflect.FullName]Type + scalarFlagTypes map[string]Type +} + +func (b *Builder) init() { + if b.messageFlagTypes == nil { + b.messageFlagTypes = map[protoreflect.FullName]Type{} + b.messageFlagTypes["google.protobuf.Timestamp"] = timestampType{} + b.messageFlagTypes["google.protobuf.Duration"] = durationType{} + } + + if b.scalarFlagTypes == nil { + b.scalarFlagTypes = map[string]Type{} + b.scalarFlagTypes["cosmos.AddressString"] = addressStringType{} + } +} + +func (b *Builder) DefineMessageFlagType(messageName protoreflect.FullName, flagType Type) { + b.init() + b.messageFlagTypes[messageName] = flagType +} + +func (b *Builder) DefineScalarFlagType(scalarName string, flagType Type) { + b.init() + b.scalarFlagTypes[scalarName] = flagType +} diff --git a/client/v2/cli/flag/duration.go b/client/v2/cli/flag/duration.go new file mode 100644 index 0000000000..d40f3ad6ea --- /dev/null +++ b/client/v2/cli/flag/duration.go @@ -0,0 +1,52 @@ +package flag + +import ( + "context" + "time" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/known/durationpb" +) + +type durationType struct{} + +func (t durationType) NewValue(context.Context, *Builder) pflag.Value { + return &durationValue{} +} + +func (t durationType) DefaultValue() string { + return "" +} + +type durationValue struct { + value *durationpb.Duration +} + +func (t durationValue) Get() protoreflect.Value { + if t.value == nil { + return protoreflect.Value{} + } + return protoreflect.ValueOfMessage(t.value.ProtoReflect()) +} + +func (v durationValue) String() string { + if v.value == nil { + return "" + } + return v.value.AsDuration().String() +} + +func (v *durationValue) Set(s string) error { + dur, err := time.ParseDuration(s) + if err != nil { + return err + } + + v.value = durationpb.New(dur) + return nil +} + +func (v durationValue) Type() string { + return "duration" +} diff --git a/client/v2/cli/flag/enum.go b/client/v2/cli/flag/enum.go new file mode 100644 index 0000000000..65dd6fb813 --- /dev/null +++ b/client/v2/cli/flag/enum.go @@ -0,0 +1,74 @@ +package flag + +import ( + "context" + "fmt" + "strings" + + "github.com/iancoleman/strcase" + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type enumType struct { + enum protoreflect.EnumDescriptor +} + +func (b enumType) NewValue(context.Context, *Builder) pflag.Value { + val := &enumValue{ + enum: b.enum, + valMap: map[string]protoreflect.EnumValueDescriptor{}, + } + n := b.enum.Values().Len() + for i := 0; i < n; i++ { + valDesc := b.enum.Values().Get(i) + val.valMap[enumValueName(b.enum, valDesc)] = valDesc + } + return val +} + +func (b enumType) DefaultValue() string { + defValue := "" + if def := b.enum.Values().ByNumber(0); def != nil { + defValue = enumValueName(b.enum, def) + } + return defValue +} + +type enumValue struct { + enum protoreflect.EnumDescriptor + value protoreflect.EnumNumber + valMap map[string]protoreflect.EnumValueDescriptor +} + +func (e enumValue) Get() protoreflect.Value { + return protoreflect.ValueOfEnum(e.value) +} + +func enumValueName(enum protoreflect.EnumDescriptor, enumValue protoreflect.EnumValueDescriptor) string { + name := string(enumValue.Name()) + name = strings.TrimPrefix(name, strcase.ToScreamingSnake(string(enum.Name()))+"_") + return strcase.ToKebab(name) +} + +func (e enumValue) String() string { + return enumValueName(e.enum, e.enum.Values().ByNumber(e.value)) +} + +func (e *enumValue) Set(s string) error { + valDesc, ok := e.valMap[s] + if !ok { + return fmt.Errorf("%s is not a valid value for enum %s", s, e.enum.FullName()) + } + e.value = valDesc.Number() + return nil +} + +func (e enumValue) Type() string { + var vals []string + n := e.enum.Values().Len() + for i := 0; i < n; i++ { + vals = append(vals, enumValueName(e.enum, e.enum.Values().Get(i))) + } + return fmt.Sprintf("%s (%s)", e.enum.Name(), strings.Join(vals, " | ")) +} diff --git a/client/v2/cli/flag/field.go b/client/v2/cli/flag/field.go new file mode 100644 index 0000000000..fa96802e99 --- /dev/null +++ b/client/v2/cli/flag/field.go @@ -0,0 +1,129 @@ +package flag + +import ( + "context" + "fmt" + + cosmos_proto "github.com/cosmos/cosmos-proto" + "github.com/spf13/pflag" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + "github.com/cosmos/cosmos-sdk/client/v2/internal/util" +) + +// FieldValueBinder wraps a flag value in a way that allows it to be bound +// to a particular field in a protobuf message. +type FieldValueBinder interface { + Bind(message protoreflect.Message, field protoreflect.FieldDescriptor) +} + +// Options specifies options for specific flags. +type Options struct { + + // Prefix is a prefix to prepend to all flags. + Prefix string +} + +// AddFieldFlag adds a flag for the provided field to the flag set. +func (b *Builder) AddFieldFlag(ctx context.Context, flagSet *pflag.FlagSet, field protoreflect.FieldDescriptor, options Options) FieldValueBinder { + if field.Kind() == protoreflect.MessageKind && field.Message().FullName() == "cosmos.base.query.v1beta1.PageRequest" { + return b.bindPageRequest(ctx, flagSet, field) + } + + name := options.Prefix + util.DescriptorKebabName(field) + usage := util.DescriptorDocs(field) + shorthand := "" + + if typ := b.resolveFlagType(field); typ != nil { + val := typ.NewValue(ctx, b) + flagSet.AddFlag(&pflag.Flag{ + Name: name, + Shorthand: shorthand, + Usage: usage, + DefValue: typ.DefaultValue(), + Value: val, + }) + switch val := val.(type) { + case SimpleValue: + return simpleValueBinder{val} + case ListValue: + return listValueBinder{val} + default: + panic(fmt.Errorf("%T does not implement SimpleValue or ListValue", val)) + } + } + + if field.IsList() { + if value := bindSimpleListFlag(flagSet, field.Kind(), name, shorthand, usage); value != nil { + return listValueBinder{value} + } + return nil + } + + if value := bindSimpleFlag(flagSet, field.Kind(), name, shorthand, usage); value != nil { + return simpleValueBinder{value} + } + + return nil +} + +func (b *Builder) resolveFlagType(field protoreflect.FieldDescriptor) Type { + typ := b.resolveFlagTypeBasic(field) + if field.IsList() { + if typ != nil { + return compositeListType{simpleType: typ} + } + + return nil + } + + return typ +} + +func (b *Builder) resolveFlagTypeBasic(field protoreflect.FieldDescriptor) Type { + scalar := proto.GetExtension(field.Options(), cosmos_proto.E_Scalar) + if scalar != nil { + b.init() + if typ, ok := b.scalarFlagTypes[scalar.(string)]; ok { + return typ + } + } + + switch field.Kind() { + case protoreflect.EnumKind: + return enumType{enum: field.Enum()} + case protoreflect.MessageKind: + b.init() + if flagType, ok := b.messageFlagTypes[field.Message().FullName()]; ok { + return flagType + } + + return jsonMessageFlagType{ + messageDesc: field.Message(), + } + default: + return nil + } +} + +type simpleValueBinder struct { + SimpleValue +} + +func (s simpleValueBinder) Bind(message protoreflect.Message, field protoreflect.FieldDescriptor) { + val := s.Get() + if val.IsValid() { + message.Set(field, val) + } else { + message.Clear(field) + } +} + +type listValueBinder struct { + ListValue +} + +func (s listValueBinder) Bind(message protoreflect.Message, field protoreflect.FieldDescriptor) { + s.AppendTo(message.NewField(field).List()) +} diff --git a/client/v2/cli/flag/list.go b/client/v2/cli/flag/list.go new file mode 100644 index 0000000000..28f3b8fe7f --- /dev/null +++ b/client/v2/cli/flag/list.go @@ -0,0 +1,107 @@ +package flag + +import ( + "context" + "fmt" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func bindSimpleListFlag(flagSet *pflag.FlagSet, kind protoreflect.Kind, name, shorthand, usage string) ListValue { + switch kind { + case protoreflect.StringKind: + val := flagSet.StringSliceP(name, shorthand, nil, usage) + return listValue(func(list protoreflect.List) { + for _, x := range *val { + list.Append(protoreflect.ValueOfString(x)) + } + }) + case protoreflect.BytesKind: + // TODO + return nil + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, + protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + val := flagSet.UintSliceP(name, shorthand, nil, usage) + return listValue(func(list protoreflect.List) { + for _, x := range *val { + list.Append(protoreflect.ValueOfUint64(uint64(x))) + } + }) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, + protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := flagSet.IntSliceP(name, shorthand, nil, usage) + return listValue(func(list protoreflect.List) { + for _, x := range *val { + list.Append(protoreflect.ValueOfInt64(int64(x))) + } + }) + case protoreflect.BoolKind: + val := flagSet.BoolSliceP(name, shorthand, nil, usage) + return listValue(func(list protoreflect.List) { + for _, x := range *val { + list.Append(protoreflect.ValueOfBool(x)) + } + }) + default: + return nil + } +} + +type listValue func(protoreflect.List) + +func (f listValue) AppendTo(list protoreflect.List) { + f(list) +} + +type compositeListType struct { + simpleType Type +} + +func (t compositeListType) NewValue(ctx context.Context, opts *Builder) pflag.Value { + return &compositeListValue{ + simpleType: t.simpleType, + values: nil, + ctx: ctx, + opts: opts, + } +} + +func (t compositeListType) DefaultValue() string { + return "" +} + +type compositeListValue struct { + simpleType Type + values []protoreflect.Value + ctx context.Context + opts *Builder +} + +func (c compositeListValue) AppendTo(list protoreflect.List) { + for _, value := range c.values { + list.Append(value) + } +} + +func (c compositeListValue) String() string { + if len(c.values) == 0 { + return "" + } + + return fmt.Sprintf("%+v", c.values) +} + +func (c *compositeListValue) Set(val string) error { + simpleVal := c.simpleType.NewValue(c.ctx, c.opts) + err := simpleVal.Set(val) + if err != nil { + return err + } + c.values = append(c.values, simpleVal.(SimpleValue).Get()) + return nil +} + +func (c compositeListValue) Type() string { + return fmt.Sprintf("%s (repeated)", c.simpleType.NewValue(c.ctx, c.opts).Type()) +} diff --git a/client/v2/cli/flag/message.go b/client/v2/cli/flag/message.go new file mode 100644 index 0000000000..4883b8933c --- /dev/null +++ b/client/v2/cli/flag/message.go @@ -0,0 +1,64 @@ +package flag + +import ( + "context" + "fmt" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + "github.com/cosmos/cosmos-sdk/client/v2/internal/util" +) + +type jsonMessageFlagType struct { + messageDesc protoreflect.MessageDescriptor +} + +func (j jsonMessageFlagType) NewValue(_ context.Context, builder *Builder) pflag.Value { + return &jsonMessageFlagValue{ + messageType: util.ResolveMessageType(builder.TypeResolver, j.messageDesc), + jsonMarshalOptions: protojson.MarshalOptions{Resolver: builder.TypeResolver}, + jsonUnmarshalOptions: protojson.UnmarshalOptions{Resolver: builder.TypeResolver}, + } +} + +func (j jsonMessageFlagType) DefaultValue() string { + return "" +} + +type jsonMessageFlagValue struct { + jsonMarshalOptions protojson.MarshalOptions + jsonUnmarshalOptions protojson.UnmarshalOptions + messageType protoreflect.MessageType + message proto.Message +} + +func (j jsonMessageFlagValue) Get() protoreflect.Value { + if j.message == nil { + return protoreflect.Value{} + } + return protoreflect.ValueOfMessage(j.message.ProtoReflect()) +} + +func (j jsonMessageFlagValue) String() string { + if j.message == nil { + return "" + } + + bz, err := j.jsonMarshalOptions.Marshal(j.message) + if err != nil { + return err.Error() + } + return string(bz) +} + +func (j *jsonMessageFlagValue) Set(s string) error { + j.message = j.messageType.New().Interface() + return j.jsonUnmarshalOptions.Unmarshal([]byte(s), j.message) +} + +func (j jsonMessageFlagValue) Type() string { + return fmt.Sprintf("%s (json)", j.messageType.Descriptor().FullName()) +} diff --git a/client/v2/cli/flag/pagination.go b/client/v2/cli/flag/pagination.go new file mode 100644 index 0000000000..b4e77b8941 --- /dev/null +++ b/client/v2/cli/flag/pagination.go @@ -0,0 +1,20 @@ +package flag + +import ( + "context" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" + + "github.com/cosmos/cosmos-sdk/client/v2/internal/util" +) + +func (b *Builder) bindPageRequest(ctx context.Context, flagSet *pflag.FlagSet, field protoreflect.FieldDescriptor) FieldValueBinder { + handler := b.AddMessageFlags( + ctx, + flagSet, + util.ResolveMessageType(b.TypeResolver, field.Message()), + Options{Prefix: "page-"}, + ) + return simpleValueBinder{handler} +} diff --git a/client/v2/cli/flag/register.go b/client/v2/cli/flag/register.go new file mode 100644 index 0000000000..c0d15c17d4 --- /dev/null +++ b/client/v2/cli/flag/register.go @@ -0,0 +1,59 @@ +package flag + +import ( + "context" + "fmt" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" +) + +// AddMessageFlags adds flags for each field in the message to the flag set. +func (b *Builder) AddMessageFlags(ctx context.Context, set *pflag.FlagSet, messageType protoreflect.MessageType, options Options) *MessageBinder { + fields := messageType.Descriptor().Fields() + numFields := fields.Len() + handler := &MessageBinder{ + messageType: messageType, + } + for i := 0; i < numFields; i++ { + field := fields.Get(i) + binder := b.AddFieldFlag(ctx, set, field, options) + if binder == nil { + fmt.Printf("unable to bind field %s to a flag, support will be added soon\n", field) + continue + } + handler.flagFieldPairs = append(handler.flagFieldPairs, struct { + binder FieldValueBinder + field protoreflect.FieldDescriptor + }{binder: binder, field: field}) + } + return handler +} + +// MessageBinder binds multiple flags in a flag set to a protobuf message. +type MessageBinder struct { + flagFieldPairs []struct { + binder FieldValueBinder + field protoreflect.FieldDescriptor + } + messageType protoreflect.MessageType +} + +// BuildMessage builds and returns a new message for the bound flags. +func (m MessageBinder) BuildMessage() protoreflect.Message { + msg := m.messageType.New() + m.Bind(msg) + return msg +} + +// Bind binds the flag values to an existing protobuf message. +func (m MessageBinder) Bind(msg protoreflect.Message) { + for _, pair := range m.flagFieldPairs { + pair.binder.Bind(msg, pair.field) + } +} + +// Get calls BuildMessage and wraps the result in a protoreflect.Value. +func (m MessageBinder) Get() protoreflect.Value { + return protoreflect.ValueOfMessage(m.BuildMessage()) +} diff --git a/client/v2/cli/flag/simple.go b/client/v2/cli/flag/simple.go new file mode 100644 index 0000000000..6caf25c6ca --- /dev/null +++ b/client/v2/cli/flag/simple.go @@ -0,0 +1,54 @@ +package flag + +import ( + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func bindSimpleFlag(flagSet *pflag.FlagSet, kind protoreflect.Kind, name, shorthand, usage string) SimpleValue { + switch kind { + case protoreflect.BytesKind: + val := flagSet.BytesBase64P(name, shorthand, nil, usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfBytes(*val) + }) + case protoreflect.StringKind: + val := flagSet.StringP(name, shorthand, "", usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfString(*val) + }) + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + val := flagSet.Uint32P(name, shorthand, 0, usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfUint32(*val) + }) + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + val := flagSet.Uint64P(name, shorthand, 0, usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfUint64(*val) + }) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := flagSet.Int32P(name, shorthand, 0, usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfInt32(*val) + }) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := flagSet.Int64P(name, shorthand, 0, usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfInt64(*val) + }) + case protoreflect.BoolKind: + val := flagSet.BoolP(name, shorthand, false, usage) + return simpleValue(func() protoreflect.Value { + return protoreflect.ValueOfBool(*val) + }) + default: + return nil + } +} + +type simpleValue func() protoreflect.Value + +func (f simpleValue) Get() protoreflect.Value { + return f() +} diff --git a/client/v2/cli/flag/timestamp.go b/client/v2/cli/flag/timestamp.go new file mode 100644 index 0000000000..e9386bad3b --- /dev/null +++ b/client/v2/cli/flag/timestamp.go @@ -0,0 +1,51 @@ +package flag + +import ( + "context" + "time" + + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/known/timestamppb" +) + +type timestampType struct{} + +func (t timestampType) NewValue(context.Context, *Builder) pflag.Value { + return ×tampValue{} +} + +func (t timestampType) DefaultValue() string { + return "" +} + +type timestampValue struct { + value *timestamppb.Timestamp +} + +func (t timestampValue) Get() protoreflect.Value { + if t.value == nil { + return protoreflect.Value{} + } + return protoreflect.ValueOfMessage(t.value.ProtoReflect()) +} + +func (v timestampValue) String() string { + if v.value == nil { + return "" + } + return v.value.AsTime().Format(time.RFC3339) +} + +func (v *timestampValue) Set(s string) error { + t, err := time.Parse(time.RFC3339, s) + if err != nil { + return err + } + v.value = timestamppb.New(t) + return nil +} + +func (v timestampValue) Type() string { + return "timestamp (RFC 3339)" +} diff --git a/client/v2/cli/flag/type.go b/client/v2/cli/flag/type.go new file mode 100644 index 0000000000..c47e31f7e8 --- /dev/null +++ b/client/v2/cli/flag/type.go @@ -0,0 +1,18 @@ +package flag + +import ( + "context" + + "github.com/spf13/pflag" +) + +// Type specifies a custom flag type. +type Type interface { + + // NewValue returns a new pflag.Value which must also implement either + // SimpleValue or ListValue. + NewValue(context.Context, *Builder) pflag.Value + + // DefaultValue is the default value for this type. + DefaultValue() string +} diff --git a/client/v2/cli/flag/value.go b/client/v2/cli/flag/value.go new file mode 100644 index 0000000000..94d75bf05d --- /dev/null +++ b/client/v2/cli/flag/value.go @@ -0,0 +1,19 @@ +package flag + +import ( + "google.golang.org/protobuf/reflect/protoreflect" +) + +// SimpleValue wraps a simple (non-list and non-map) protobuf value. +type SimpleValue interface { + + // Get returns the value. + Get() protoreflect.Value +} + +// ListValue wraps a protobuf list/repeating value. +type ListValue interface { + + // AppendTo appends the values to the provided list. + AppendTo(protoreflect.List) +} diff --git a/client/v2/cli/query.go b/client/v2/cli/query.go new file mode 100644 index 0000000000..28c02a4a79 --- /dev/null +++ b/client/v2/cli/query.go @@ -0,0 +1,87 @@ +package cli + +import ( + "fmt" + + "github.com/iancoleman/strcase" + "github.com/spf13/cobra" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + "github.com/cosmos/cosmos-sdk/client/v2/cli/flag" + "github.com/cosmos/cosmos-sdk/client/v2/internal/util" +) + +// AddQueryServiceCommands adds a sub-command to the provided command for each +// method in the specified service and returns the command. +func (b *Builder) AddQueryServiceCommands(command *cobra.Command, serviceName protoreflect.FullName) *cobra.Command { + resolver := b.FileResolver + if resolver == nil { + resolver = protoregistry.GlobalFiles + } + descriptor, err := resolver.FindDescriptorByName(serviceName) + if err != nil { + panic(err) + } + + service := descriptor.(protoreflect.ServiceDescriptor) + methods := service.Methods() + n := methods.Len() + for i := 0; i < n; i++ { + cmd := b.CreateQueryMethodCommand(methods.Get(i)) + command.AddCommand(cmd) + } + return command +} + +// CreateQueryMethodCommand creates a gRPC query command for the given service method. +func (b *Builder) CreateQueryMethodCommand(descriptor protoreflect.MethodDescriptor) *cobra.Command { + serviceDescriptor := descriptor.Parent().(protoreflect.ServiceDescriptor) + docs := util.DescriptorDocs(descriptor) + getClientConn := b.GetClientConn + methodName := fmt.Sprintf("/%s/%s", serviceDescriptor.FullName(), descriptor.Name()) + + inputDesc := descriptor.Input() + inputType := util.ResolveMessageType(b.TypeResolver, inputDesc) + outputType := util.ResolveMessageType(b.TypeResolver, descriptor.Output()) + cmd := &cobra.Command{ + Use: protoNameToCliName(descriptor.Name()), + Long: docs, + } + + binder := b.AddMessageFlags(cmd.Context(), cmd.Flags(), inputType, flag.Options{}) + + jsonMarshalOptions := protojson.MarshalOptions{ + Indent: " ", + UseProtoNames: true, + UseEnumNumbers: false, + EmitUnpopulated: true, + Resolver: b.TypeResolver, + } + + cmd.RunE = func(cmd *cobra.Command, args []string) error { + ctx := cmd.Context() + clientConn := getClientConn(ctx) + input := binder.BuildMessage() + output := outputType.New() + err := clientConn.Invoke(ctx, methodName, input.Interface(), output.Interface()) + if err != nil { + return err + } + + bz, err := jsonMarshalOptions.Marshal(output.Interface()) + if err != nil { + return err + } + + _, err = fmt.Fprintln(cmd.OutOrStdout(), string(bz)) + return err + } + + return cmd +} + +func protoNameToCliName(name protoreflect.Name) string { + return strcase.ToKebab(string(name)) +} diff --git a/client/v2/cli/query_test.go b/client/v2/cli/query_test.go new file mode 100644 index 0000000000..6d6c96c49f --- /dev/null +++ b/client/v2/cli/query_test.go @@ -0,0 +1,117 @@ +package cli + +import ( + "bytes" + "context" + "net" + "testing" + + "github.com/spf13/cobra" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/testing/protocmp" + "gotest.tools/v3/assert" + "gotest.tools/v3/golden" + + "github.com/cosmos/cosmos-sdk/client/v2/internal/testpb" +) + +func testExec(t *testing.T, args ...string) *testClientConn { + server := grpc.NewServer() + testpb.RegisterQueryServer(server, &testEchoServer{}) + listener, err := net.Listen("tcp", "127.0.0.1:0") + assert.NilError(t, err) + go server.Serve(listener) + defer server.GracefulStop() + clientConn, err := grpc.Dial(listener.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) + assert.NilError(t, err) + defer clientConn.Close() + + conn := &testClientConn{ + ClientConn: clientConn, + t: t, + out: &bytes.Buffer{}, + } + b := &Builder{ + GetClientConn: func(ctx context.Context) grpc.ClientConnInterface { + return conn + }, + } + cmd := b.AddQueryServiceCommands(&cobra.Command{Use: "test"}, protoreflect.FullName(testpb.Query_ServiceDesc.ServiceName)) + cmd.SetArgs(args) + cmd.SetOut(conn.out) + assert.NilError(t, cmd.Execute()) + return conn +} + +func TestEcho(t *testing.T) { + conn := testExec(t, + "echo", + "--a-bool", + "--an-enum", "one", + "--a-message", `{"bar":"abc", "baz":-3}`, + "--duration", "4h3s", + "--u-32", "27", + "--u-64", "3267246890", + "--i-32", "-253", + "--i-64", "-234602347", + "--str", "def", + "--timestamp", "2019-01-02T00:01:02Z", + "--a-coin", `{"denom":"foo","amount":"100000"}`, + "--an-address", "cosmossdghdsfoi2134sdgh", + "--bz", "c2RncXdlZndkZ3NkZw==", + "--page-count-total", + "--page-key", "MTIzNTQ4N3NnaGRhcw==", + "--page-limit", "1000", + "--page-offset", "10", + "--page-reverse", + "--bools", "true", + "--bools", "false,false,true", + "--enums", "one", + "--enums", "five", + "--enums", "two", + "--strings", "abc", + "--strings", "xyz", + "--strings", "xyz,qrs", + "--durations", "3s", + "--durations", "5s", + "--durations", "10h", + "--some-messages", "{}", + "--some-messages", `{"bar":"baz"}`, + "--some-messages", `{"baz":-1}`, + "--uints", "1,2,3", + "--uints", "4", + ) + assert.DeepEqual(t, conn.lastRequest, conn.lastResponse.(*testpb.EchoResponse).Request, protocmp.Transform()) +} + +func TestHelp(t *testing.T) { + conn := testExec(t, "echo", "-h") + golden.Assert(t, conn.out.String(), "help.golden") +} + +type testClientConn struct { + *grpc.ClientConn + t *testing.T + lastRequest interface{} + lastResponse interface{} + out *bytes.Buffer +} + +func (t *testClientConn) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error { + err := t.ClientConn.Invoke(ctx, method, args, reply, opts...) + t.lastRequest = args + t.lastResponse = reply + return err +} + +type testEchoServer struct { + testpb.UnimplementedQueryServer +} + +func (t testEchoServer) Echo(_ context.Context, request *testpb.EchoRequest) (*testpb.EchoResponse, error) { + return &testpb.EchoResponse{Request: request}, nil +} + +var _ testpb.QueryServer = testEchoServer{} diff --git a/client/v2/cli/testdata/help.golden b/client/v2/cli/testdata/help.golden new file mode 100644 index 0000000000..bcb9c087fd --- /dev/null +++ b/client/v2/cli/testdata/help.golden @@ -0,0 +1,29 @@ +Usage: + test echo [flags] + +Flags: + --a-bool + --a-coin cosmos.base.v1beta1.Coin (json) + --a-message testpb.AMessage (json) + --an-address bech32 account address key name + --an-enum Enum (unspecified | one | two | five | neg-three) (default unspecified) + --bools bools (default []) + --bz bytesBase64 + --duration duration + --durations duration (repeated) + --enums Enum (unspecified | one | two | five | neg-three) (repeated) + -h, --help help for echo + --i-32 int32 + --i-64 int + --page-count-total + --page-key bytesBase64 + --page-limit uint + --page-offset uint + --page-reverse + --some-messages testpb.AMessage (json) (repeated) + --str string + --strings strings + --timestamp timestamp (RFC 3339) + --u-32 uint32 + --u-64 uint + --uints uints (default []) diff --git a/client/v2/go.mod b/client/v2/go.mod new file mode 100644 index 0000000000..ea6fe6cbdc --- /dev/null +++ b/client/v2/go.mod @@ -0,0 +1,26 @@ +module github.com/cosmos/cosmos-sdk/client/v2 + +go 1.18 + +require ( + github.com/cosmos/cosmos-sdk/api v0.1.0 + github.com/iancoleman/strcase v0.2.0 + github.com/spf13/cobra v1.4.0 + github.com/spf13/pflag v1.0.5 + google.golang.org/grpc v1.45.0 + google.golang.org/protobuf v1.28.0 + gotest.tools/v3 v3.1.0 +) + +require ( + github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.6 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect +) diff --git a/client/v2/go.sum b/client/v2/go.sum new file mode 100644 index 0000000000..8ff37c7026 --- /dev/null +++ b/client/v2/go.sum @@ -0,0 +1,181 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= +github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= +github.com/cosmos/cosmos-sdk/api v0.1.0 h1:xfSKM0e9p+EJTMQnf5PbWE6VT8ruxTABIJ64Rd064dE= +github.com/cosmos/cosmos-sdk/api v0.1.0/go.mod h1:CupqQBskAOiTXO1XDZ/wrtWzN/wTxUvbQmOqdUhR8wI= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw= +google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk= +gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= diff --git a/client/v2/internal/buf.gen.yaml b/client/v2/internal/buf.gen.yaml new file mode 100644 index 0000000000..1e933d3117 --- /dev/null +++ b/client/v2/internal/buf.gen.yaml @@ -0,0 +1,16 @@ +version: v1 +managed: + enabled: true + go_package_prefix: + default: github.com/cosmos/cosmos-sdk/client/v2/internal + except: + - buf.build/cosmos/cosmos-proto + override: + buf.build/cosmos/cosmos-sdk: github.com/cosmos/cosmos-sdk/api +plugins: + - name: go-pulsar + out: . + opt: paths=source_relative + - name: go-grpc + out: . + opt: paths=source_relative diff --git a/client/v2/internal/buf.lock b/client/v2/internal/buf.lock new file mode 100644 index 0000000000..3278c9b656 --- /dev/null +++ b/client/v2/internal/buf.lock @@ -0,0 +1,23 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: cosmos + repository: cosmos-proto + branch: main + commit: 1935555c206d4afb9e94615dfd0fad31 + - remote: buf.build + owner: cosmos + repository: cosmos-sdk + branch: main + commit: 86d2a697b026488089f13a71ceb3815c + - remote: buf.build + owner: cosmos + repository: gogo-proto + branch: main + commit: bee5511075b7499da6178d9e4aaa628b + - remote: buf.build + owner: googleapis + repository: googleapis + branch: main + commit: 40f07f5b563941f2b20b991a7aedd53d diff --git a/client/v2/internal/buf.yaml b/client/v2/internal/buf.yaml new file mode 100644 index 0000000000..96af160bf1 --- /dev/null +++ b/client/v2/internal/buf.yaml @@ -0,0 +1,12 @@ +version: v1 +deps: + - buf.build/cosmos/cosmos-sdk + - buf.build/cosmos/cosmos-proto +lint: + use: + - DEFAULT + except: + - PACKAGE_VERSION_SUFFIX +breaking: + ignore: + - testpb diff --git a/client/v2/internal/testpb/query.proto b/client/v2/internal/testpb/query.proto new file mode 100644 index 0000000000..062953a358 --- /dev/null +++ b/client/v2/internal/testpb/query.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; + +package testpb; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +service Query { + // Echo returns the request in the response + rpc Echo(EchoRequest) returns (EchoResponse); +} + +message EchoRequest { + // u32 is an uint32 + uint32 u32 = 1; + uint64 u64 = 2; + string str = 3; + bytes bz = 4; + google.protobuf.Timestamp timestamp = 5; + google.protobuf.Duration duration = 6; + int32 i32 = 7; + int64 i64 = 10; + bool a_bool = 15; + Enum an_enum = 16; + AMessage a_message = 17; + cosmos.base.v1beta1.Coin a_coin = 18; + string an_address = 19 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.query.v1beta1.PageRequest page = 20; + repeated bool bools = 21; + repeated uint32 uints = 22; + repeated string strings = 23; + repeated Enum enums = 24; + repeated google.protobuf.Duration durations = 25; + repeated AMessage some_messages = 26; +} + +enum Enum { + ENUM_UNSPECIFIED = 0; + ENUM_ONE = 1; + ENUM_TWO = 2; + ENUM_FIVE = 5; + ENUM_NEG_THREE = -3; +} + +message AMessage { + string bar = 1; + int32 baz = 2; +} + +message EchoResponse { + EchoRequest request = 1; +} \ No newline at end of file diff --git a/client/v2/internal/testpb/query.pulsar.go b/client/v2/internal/testpb/query.pulsar.go new file mode 100644 index 0000000000..33b424acd2 --- /dev/null +++ b/client/v2/internal/testpb/query.pulsar.go @@ -0,0 +1,3631 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package testpb + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + v1beta11 "github.com/cosmos/cosmos-sdk/api/cosmos/base/query/v1beta1" + v1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/v1beta1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_EchoRequest_21_list)(nil) + +type _EchoRequest_21_list struct { + list *[]bool +} + +func (x *_EchoRequest_21_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EchoRequest_21_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfBool((*x.list)[i]) +} + +func (x *_EchoRequest_21_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Bool() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_EchoRequest_21_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Bool() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_EchoRequest_21_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message EchoRequest at list field Bools as it is not of Message kind")) +} + +func (x *_EchoRequest_21_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_EchoRequest_21_list) NewElement() protoreflect.Value { + v := false + return protoreflect.ValueOfBool(v) +} + +func (x *_EchoRequest_21_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_EchoRequest_22_list)(nil) + +type _EchoRequest_22_list struct { + list *[]uint32 +} + +func (x *_EchoRequest_22_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EchoRequest_22_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfUint32((*x.list)[i]) +} + +func (x *_EchoRequest_22_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Uint() + concreteValue := (uint32)(valueUnwrapped) + (*x.list)[i] = concreteValue +} + +func (x *_EchoRequest_22_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Uint() + concreteValue := (uint32)(valueUnwrapped) + *x.list = append(*x.list, concreteValue) +} + +func (x *_EchoRequest_22_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message EchoRequest at list field Uints as it is not of Message kind")) +} + +func (x *_EchoRequest_22_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_EchoRequest_22_list) NewElement() protoreflect.Value { + v := uint32(0) + return protoreflect.ValueOfUint32(v) +} + +func (x *_EchoRequest_22_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_EchoRequest_23_list)(nil) + +type _EchoRequest_23_list struct { + list *[]string +} + +func (x *_EchoRequest_23_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EchoRequest_23_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_EchoRequest_23_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_EchoRequest_23_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_EchoRequest_23_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message EchoRequest at list field Strings as it is not of Message kind")) +} + +func (x *_EchoRequest_23_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_EchoRequest_23_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_EchoRequest_23_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_EchoRequest_24_list)(nil) + +type _EchoRequest_24_list struct { + list *[]Enum +} + +func (x *_EchoRequest_24_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EchoRequest_24_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)((*x.list)[i])) +} + +func (x *_EchoRequest_24_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Enum() + concreteValue := (Enum)(valueUnwrapped) + (*x.list)[i] = concreteValue +} + +func (x *_EchoRequest_24_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Enum() + concreteValue := (Enum)(valueUnwrapped) + *x.list = append(*x.list, concreteValue) +} + +func (x *_EchoRequest_24_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message EchoRequest at list field Enums as it is not of Message kind")) +} + +func (x *_EchoRequest_24_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_EchoRequest_24_list) NewElement() protoreflect.Value { + v := 0 + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(v)) +} + +func (x *_EchoRequest_24_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_EchoRequest_25_list)(nil) + +type _EchoRequest_25_list struct { + list *[]*durationpb.Duration +} + +func (x *_EchoRequest_25_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EchoRequest_25_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_EchoRequest_25_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*durationpb.Duration) + (*x.list)[i] = concreteValue +} + +func (x *_EchoRequest_25_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*durationpb.Duration) + *x.list = append(*x.list, concreteValue) +} + +func (x *_EchoRequest_25_list) AppendMutable() protoreflect.Value { + v := new(durationpb.Duration) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EchoRequest_25_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_EchoRequest_25_list) NewElement() protoreflect.Value { + v := new(durationpb.Duration) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EchoRequest_25_list) IsValid() bool { + return x.list != nil +} + +var _ protoreflect.List = (*_EchoRequest_26_list)(nil) + +type _EchoRequest_26_list struct { + list *[]*AMessage +} + +func (x *_EchoRequest_26_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_EchoRequest_26_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_EchoRequest_26_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*AMessage) + (*x.list)[i] = concreteValue +} + +func (x *_EchoRequest_26_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*AMessage) + *x.list = append(*x.list, concreteValue) +} + +func (x *_EchoRequest_26_list) AppendMutable() protoreflect.Value { + v := new(AMessage) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EchoRequest_26_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_EchoRequest_26_list) NewElement() protoreflect.Value { + v := new(AMessage) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EchoRequest_26_list) IsValid() bool { + return x.list != nil +} + +var ( + md_EchoRequest protoreflect.MessageDescriptor + fd_EchoRequest_u32 protoreflect.FieldDescriptor + fd_EchoRequest_u64 protoreflect.FieldDescriptor + fd_EchoRequest_str protoreflect.FieldDescriptor + fd_EchoRequest_bz protoreflect.FieldDescriptor + fd_EchoRequest_timestamp protoreflect.FieldDescriptor + fd_EchoRequest_duration protoreflect.FieldDescriptor + fd_EchoRequest_i32 protoreflect.FieldDescriptor + fd_EchoRequest_i64 protoreflect.FieldDescriptor + fd_EchoRequest_a_bool protoreflect.FieldDescriptor + fd_EchoRequest_an_enum protoreflect.FieldDescriptor + fd_EchoRequest_a_message protoreflect.FieldDescriptor + fd_EchoRequest_a_coin protoreflect.FieldDescriptor + fd_EchoRequest_an_address protoreflect.FieldDescriptor + fd_EchoRequest_page protoreflect.FieldDescriptor + fd_EchoRequest_bools protoreflect.FieldDescriptor + fd_EchoRequest_uints protoreflect.FieldDescriptor + fd_EchoRequest_strings protoreflect.FieldDescriptor + fd_EchoRequest_enums protoreflect.FieldDescriptor + fd_EchoRequest_durations protoreflect.FieldDescriptor + fd_EchoRequest_some_messages protoreflect.FieldDescriptor +) + +func init() { + file_testpb_query_proto_init() + md_EchoRequest = File_testpb_query_proto.Messages().ByName("EchoRequest") + fd_EchoRequest_u32 = md_EchoRequest.Fields().ByName("u32") + fd_EchoRequest_u64 = md_EchoRequest.Fields().ByName("u64") + fd_EchoRequest_str = md_EchoRequest.Fields().ByName("str") + fd_EchoRequest_bz = md_EchoRequest.Fields().ByName("bz") + fd_EchoRequest_timestamp = md_EchoRequest.Fields().ByName("timestamp") + fd_EchoRequest_duration = md_EchoRequest.Fields().ByName("duration") + fd_EchoRequest_i32 = md_EchoRequest.Fields().ByName("i32") + fd_EchoRequest_i64 = md_EchoRequest.Fields().ByName("i64") + fd_EchoRequest_a_bool = md_EchoRequest.Fields().ByName("a_bool") + fd_EchoRequest_an_enum = md_EchoRequest.Fields().ByName("an_enum") + fd_EchoRequest_a_message = md_EchoRequest.Fields().ByName("a_message") + fd_EchoRequest_a_coin = md_EchoRequest.Fields().ByName("a_coin") + fd_EchoRequest_an_address = md_EchoRequest.Fields().ByName("an_address") + fd_EchoRequest_page = md_EchoRequest.Fields().ByName("page") + fd_EchoRequest_bools = md_EchoRequest.Fields().ByName("bools") + fd_EchoRequest_uints = md_EchoRequest.Fields().ByName("uints") + fd_EchoRequest_strings = md_EchoRequest.Fields().ByName("strings") + fd_EchoRequest_enums = md_EchoRequest.Fields().ByName("enums") + fd_EchoRequest_durations = md_EchoRequest.Fields().ByName("durations") + fd_EchoRequest_some_messages = md_EchoRequest.Fields().ByName("some_messages") +} + +var _ protoreflect.Message = (*fastReflection_EchoRequest)(nil) + +type fastReflection_EchoRequest EchoRequest + +func (x *EchoRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_EchoRequest)(x) +} + +func (x *EchoRequest) slowProtoReflect() protoreflect.Message { + mi := &file_testpb_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EchoRequest_messageType fastReflection_EchoRequest_messageType +var _ protoreflect.MessageType = fastReflection_EchoRequest_messageType{} + +type fastReflection_EchoRequest_messageType struct{} + +func (x fastReflection_EchoRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_EchoRequest)(nil) +} +func (x fastReflection_EchoRequest_messageType) New() protoreflect.Message { + return new(fastReflection_EchoRequest) +} +func (x fastReflection_EchoRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EchoRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EchoRequest) Descriptor() protoreflect.MessageDescriptor { + return md_EchoRequest +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EchoRequest) Type() protoreflect.MessageType { + return _fastReflection_EchoRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EchoRequest) New() protoreflect.Message { + return new(fastReflection_EchoRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EchoRequest) Interface() protoreflect.ProtoMessage { + return (*EchoRequest)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EchoRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.U32 != uint32(0) { + value := protoreflect.ValueOfUint32(x.U32) + if !f(fd_EchoRequest_u32, value) { + return + } + } + if x.U64 != uint64(0) { + value := protoreflect.ValueOfUint64(x.U64) + if !f(fd_EchoRequest_u64, value) { + return + } + } + if x.Str != "" { + value := protoreflect.ValueOfString(x.Str) + if !f(fd_EchoRequest_str, value) { + return + } + } + if len(x.Bz) != 0 { + value := protoreflect.ValueOfBytes(x.Bz) + if !f(fd_EchoRequest_bz, value) { + return + } + } + if x.Timestamp != nil { + value := protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) + if !f(fd_EchoRequest_timestamp, value) { + return + } + } + if x.Duration != nil { + value := protoreflect.ValueOfMessage(x.Duration.ProtoReflect()) + if !f(fd_EchoRequest_duration, value) { + return + } + } + if x.I32 != int32(0) { + value := protoreflect.ValueOfInt32(x.I32) + if !f(fd_EchoRequest_i32, value) { + return + } + } + if x.I64 != int64(0) { + value := protoreflect.ValueOfInt64(x.I64) + if !f(fd_EchoRequest_i64, value) { + return + } + } + if x.ABool != false { + value := protoreflect.ValueOfBool(x.ABool) + if !f(fd_EchoRequest_a_bool, value) { + return + } + } + if x.AnEnum != 0 { + value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.AnEnum)) + if !f(fd_EchoRequest_an_enum, value) { + return + } + } + if x.AMessage != nil { + value := protoreflect.ValueOfMessage(x.AMessage.ProtoReflect()) + if !f(fd_EchoRequest_a_message, value) { + return + } + } + if x.ACoin != nil { + value := protoreflect.ValueOfMessage(x.ACoin.ProtoReflect()) + if !f(fd_EchoRequest_a_coin, value) { + return + } + } + if x.AnAddress != "" { + value := protoreflect.ValueOfString(x.AnAddress) + if !f(fd_EchoRequest_an_address, value) { + return + } + } + if x.Page != nil { + value := protoreflect.ValueOfMessage(x.Page.ProtoReflect()) + if !f(fd_EchoRequest_page, value) { + return + } + } + if len(x.Bools) != 0 { + value := protoreflect.ValueOfList(&_EchoRequest_21_list{list: &x.Bools}) + if !f(fd_EchoRequest_bools, value) { + return + } + } + if len(x.Uints) != 0 { + value := protoreflect.ValueOfList(&_EchoRequest_22_list{list: &x.Uints}) + if !f(fd_EchoRequest_uints, value) { + return + } + } + if len(x.Strings) != 0 { + value := protoreflect.ValueOfList(&_EchoRequest_23_list{list: &x.Strings}) + if !f(fd_EchoRequest_strings, value) { + return + } + } + if len(x.Enums) != 0 { + value := protoreflect.ValueOfList(&_EchoRequest_24_list{list: &x.Enums}) + if !f(fd_EchoRequest_enums, value) { + return + } + } + if len(x.Durations) != 0 { + value := protoreflect.ValueOfList(&_EchoRequest_25_list{list: &x.Durations}) + if !f(fd_EchoRequest_durations, value) { + return + } + } + if len(x.SomeMessages) != 0 { + value := protoreflect.ValueOfList(&_EchoRequest_26_list{list: &x.SomeMessages}) + if !f(fd_EchoRequest_some_messages, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EchoRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "testpb.EchoRequest.u32": + return x.U32 != uint32(0) + case "testpb.EchoRequest.u64": + return x.U64 != uint64(0) + case "testpb.EchoRequest.str": + return x.Str != "" + case "testpb.EchoRequest.bz": + return len(x.Bz) != 0 + case "testpb.EchoRequest.timestamp": + return x.Timestamp != nil + case "testpb.EchoRequest.duration": + return x.Duration != nil + case "testpb.EchoRequest.i32": + return x.I32 != int32(0) + case "testpb.EchoRequest.i64": + return x.I64 != int64(0) + case "testpb.EchoRequest.a_bool": + return x.ABool != false + case "testpb.EchoRequest.an_enum": + return x.AnEnum != 0 + case "testpb.EchoRequest.a_message": + return x.AMessage != nil + case "testpb.EchoRequest.a_coin": + return x.ACoin != nil + case "testpb.EchoRequest.an_address": + return x.AnAddress != "" + case "testpb.EchoRequest.page": + return x.Page != nil + case "testpb.EchoRequest.bools": + return len(x.Bools) != 0 + case "testpb.EchoRequest.uints": + return len(x.Uints) != 0 + case "testpb.EchoRequest.strings": + return len(x.Strings) != 0 + case "testpb.EchoRequest.enums": + return len(x.Enums) != 0 + case "testpb.EchoRequest.durations": + return len(x.Durations) != 0 + case "testpb.EchoRequest.some_messages": + return len(x.SomeMessages) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) + } + panic(fmt.Errorf("message testpb.EchoRequest does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "testpb.EchoRequest.u32": + x.U32 = uint32(0) + case "testpb.EchoRequest.u64": + x.U64 = uint64(0) + case "testpb.EchoRequest.str": + x.Str = "" + case "testpb.EchoRequest.bz": + x.Bz = nil + case "testpb.EchoRequest.timestamp": + x.Timestamp = nil + case "testpb.EchoRequest.duration": + x.Duration = nil + case "testpb.EchoRequest.i32": + x.I32 = int32(0) + case "testpb.EchoRequest.i64": + x.I64 = int64(0) + case "testpb.EchoRequest.a_bool": + x.ABool = false + case "testpb.EchoRequest.an_enum": + x.AnEnum = 0 + case "testpb.EchoRequest.a_message": + x.AMessage = nil + case "testpb.EchoRequest.a_coin": + x.ACoin = nil + case "testpb.EchoRequest.an_address": + x.AnAddress = "" + case "testpb.EchoRequest.page": + x.Page = nil + case "testpb.EchoRequest.bools": + x.Bools = nil + case "testpb.EchoRequest.uints": + x.Uints = nil + case "testpb.EchoRequest.strings": + x.Strings = nil + case "testpb.EchoRequest.enums": + x.Enums = nil + case "testpb.EchoRequest.durations": + x.Durations = nil + case "testpb.EchoRequest.some_messages": + x.SomeMessages = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) + } + panic(fmt.Errorf("message testpb.EchoRequest does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EchoRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "testpb.EchoRequest.u32": + value := x.U32 + return protoreflect.ValueOfUint32(value) + case "testpb.EchoRequest.u64": + value := x.U64 + return protoreflect.ValueOfUint64(value) + case "testpb.EchoRequest.str": + value := x.Str + return protoreflect.ValueOfString(value) + case "testpb.EchoRequest.bz": + value := x.Bz + return protoreflect.ValueOfBytes(value) + case "testpb.EchoRequest.timestamp": + value := x.Timestamp + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "testpb.EchoRequest.duration": + value := x.Duration + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "testpb.EchoRequest.i32": + value := x.I32 + return protoreflect.ValueOfInt32(value) + case "testpb.EchoRequest.i64": + value := x.I64 + return protoreflect.ValueOfInt64(value) + case "testpb.EchoRequest.a_bool": + value := x.ABool + return protoreflect.ValueOfBool(value) + case "testpb.EchoRequest.an_enum": + value := x.AnEnum + return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) + case "testpb.EchoRequest.a_message": + value := x.AMessage + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "testpb.EchoRequest.a_coin": + value := x.ACoin + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "testpb.EchoRequest.an_address": + value := x.AnAddress + return protoreflect.ValueOfString(value) + case "testpb.EchoRequest.page": + value := x.Page + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "testpb.EchoRequest.bools": + if len(x.Bools) == 0 { + return protoreflect.ValueOfList(&_EchoRequest_21_list{}) + } + listValue := &_EchoRequest_21_list{list: &x.Bools} + return protoreflect.ValueOfList(listValue) + case "testpb.EchoRequest.uints": + if len(x.Uints) == 0 { + return protoreflect.ValueOfList(&_EchoRequest_22_list{}) + } + listValue := &_EchoRequest_22_list{list: &x.Uints} + return protoreflect.ValueOfList(listValue) + case "testpb.EchoRequest.strings": + if len(x.Strings) == 0 { + return protoreflect.ValueOfList(&_EchoRequest_23_list{}) + } + listValue := &_EchoRequest_23_list{list: &x.Strings} + return protoreflect.ValueOfList(listValue) + case "testpb.EchoRequest.enums": + if len(x.Enums) == 0 { + return protoreflect.ValueOfList(&_EchoRequest_24_list{}) + } + listValue := &_EchoRequest_24_list{list: &x.Enums} + return protoreflect.ValueOfList(listValue) + case "testpb.EchoRequest.durations": + if len(x.Durations) == 0 { + return protoreflect.ValueOfList(&_EchoRequest_25_list{}) + } + listValue := &_EchoRequest_25_list{list: &x.Durations} + return protoreflect.ValueOfList(listValue) + case "testpb.EchoRequest.some_messages": + if len(x.SomeMessages) == 0 { + return protoreflect.ValueOfList(&_EchoRequest_26_list{}) + } + listValue := &_EchoRequest_26_list{list: &x.SomeMessages} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) + } + panic(fmt.Errorf("message testpb.EchoRequest does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "testpb.EchoRequest.u32": + x.U32 = uint32(value.Uint()) + case "testpb.EchoRequest.u64": + x.U64 = value.Uint() + case "testpb.EchoRequest.str": + x.Str = value.Interface().(string) + case "testpb.EchoRequest.bz": + x.Bz = value.Bytes() + case "testpb.EchoRequest.timestamp": + x.Timestamp = value.Message().Interface().(*timestamppb.Timestamp) + case "testpb.EchoRequest.duration": + x.Duration = value.Message().Interface().(*durationpb.Duration) + case "testpb.EchoRequest.i32": + x.I32 = int32(value.Int()) + case "testpb.EchoRequest.i64": + x.I64 = value.Int() + case "testpb.EchoRequest.a_bool": + x.ABool = value.Bool() + case "testpb.EchoRequest.an_enum": + x.AnEnum = (Enum)(value.Enum()) + case "testpb.EchoRequest.a_message": + x.AMessage = value.Message().Interface().(*AMessage) + case "testpb.EchoRequest.a_coin": + x.ACoin = value.Message().Interface().(*v1beta1.Coin) + case "testpb.EchoRequest.an_address": + x.AnAddress = value.Interface().(string) + case "testpb.EchoRequest.page": + x.Page = value.Message().Interface().(*v1beta11.PageRequest) + case "testpb.EchoRequest.bools": + lv := value.List() + clv := lv.(*_EchoRequest_21_list) + x.Bools = *clv.list + case "testpb.EchoRequest.uints": + lv := value.List() + clv := lv.(*_EchoRequest_22_list) + x.Uints = *clv.list + case "testpb.EchoRequest.strings": + lv := value.List() + clv := lv.(*_EchoRequest_23_list) + x.Strings = *clv.list + case "testpb.EchoRequest.enums": + lv := value.List() + clv := lv.(*_EchoRequest_24_list) + x.Enums = *clv.list + case "testpb.EchoRequest.durations": + lv := value.List() + clv := lv.(*_EchoRequest_25_list) + x.Durations = *clv.list + case "testpb.EchoRequest.some_messages": + lv := value.List() + clv := lv.(*_EchoRequest_26_list) + x.SomeMessages = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) + } + panic(fmt.Errorf("message testpb.EchoRequest does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "testpb.EchoRequest.timestamp": + if x.Timestamp == nil { + x.Timestamp = new(timestamppb.Timestamp) + } + return protoreflect.ValueOfMessage(x.Timestamp.ProtoReflect()) + case "testpb.EchoRequest.duration": + if x.Duration == nil { + x.Duration = new(durationpb.Duration) + } + return protoreflect.ValueOfMessage(x.Duration.ProtoReflect()) + case "testpb.EchoRequest.a_message": + if x.AMessage == nil { + x.AMessage = new(AMessage) + } + return protoreflect.ValueOfMessage(x.AMessage.ProtoReflect()) + case "testpb.EchoRequest.a_coin": + if x.ACoin == nil { + x.ACoin = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.ACoin.ProtoReflect()) + case "testpb.EchoRequest.page": + if x.Page == nil { + x.Page = new(v1beta11.PageRequest) + } + return protoreflect.ValueOfMessage(x.Page.ProtoReflect()) + case "testpb.EchoRequest.bools": + if x.Bools == nil { + x.Bools = []bool{} + } + value := &_EchoRequest_21_list{list: &x.Bools} + return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.uints": + if x.Uints == nil { + x.Uints = []uint32{} + } + value := &_EchoRequest_22_list{list: &x.Uints} + return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.strings": + if x.Strings == nil { + x.Strings = []string{} + } + value := &_EchoRequest_23_list{list: &x.Strings} + return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.enums": + if x.Enums == nil { + x.Enums = []Enum{} + } + value := &_EchoRequest_24_list{list: &x.Enums} + return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.durations": + if x.Durations == nil { + x.Durations = []*durationpb.Duration{} + } + value := &_EchoRequest_25_list{list: &x.Durations} + return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.some_messages": + if x.SomeMessages == nil { + x.SomeMessages = []*AMessage{} + } + value := &_EchoRequest_26_list{list: &x.SomeMessages} + return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.u32": + panic(fmt.Errorf("field u32 of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.u64": + panic(fmt.Errorf("field u64 of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.str": + panic(fmt.Errorf("field str of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.bz": + panic(fmt.Errorf("field bz of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.i32": + panic(fmt.Errorf("field i32 of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.i64": + panic(fmt.Errorf("field i64 of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.a_bool": + panic(fmt.Errorf("field a_bool of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.an_enum": + panic(fmt.Errorf("field an_enum of message testpb.EchoRequest is not mutable")) + case "testpb.EchoRequest.an_address": + panic(fmt.Errorf("field an_address of message testpb.EchoRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) + } + panic(fmt.Errorf("message testpb.EchoRequest does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EchoRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "testpb.EchoRequest.u32": + return protoreflect.ValueOfUint32(uint32(0)) + case "testpb.EchoRequest.u64": + return protoreflect.ValueOfUint64(uint64(0)) + case "testpb.EchoRequest.str": + return protoreflect.ValueOfString("") + case "testpb.EchoRequest.bz": + return protoreflect.ValueOfBytes(nil) + case "testpb.EchoRequest.timestamp": + m := new(timestamppb.Timestamp) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "testpb.EchoRequest.duration": + m := new(durationpb.Duration) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "testpb.EchoRequest.i32": + return protoreflect.ValueOfInt32(int32(0)) + case "testpb.EchoRequest.i64": + return protoreflect.ValueOfInt64(int64(0)) + case "testpb.EchoRequest.a_bool": + return protoreflect.ValueOfBool(false) + case "testpb.EchoRequest.an_enum": + return protoreflect.ValueOfEnum(0) + case "testpb.EchoRequest.a_message": + m := new(AMessage) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "testpb.EchoRequest.a_coin": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "testpb.EchoRequest.an_address": + return protoreflect.ValueOfString("") + case "testpb.EchoRequest.page": + m := new(v1beta11.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "testpb.EchoRequest.bools": + list := []bool{} + return protoreflect.ValueOfList(&_EchoRequest_21_list{list: &list}) + case "testpb.EchoRequest.uints": + list := []uint32{} + return protoreflect.ValueOfList(&_EchoRequest_22_list{list: &list}) + case "testpb.EchoRequest.strings": + list := []string{} + return protoreflect.ValueOfList(&_EchoRequest_23_list{list: &list}) + case "testpb.EchoRequest.enums": + list := []Enum{} + return protoreflect.ValueOfList(&_EchoRequest_24_list{list: &list}) + case "testpb.EchoRequest.durations": + list := []*durationpb.Duration{} + return protoreflect.ValueOfList(&_EchoRequest_25_list{list: &list}) + case "testpb.EchoRequest.some_messages": + list := []*AMessage{} + return protoreflect.ValueOfList(&_EchoRequest_26_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) + } + panic(fmt.Errorf("message testpb.EchoRequest does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EchoRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in testpb.EchoRequest", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EchoRequest) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoRequest) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EchoRequest) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EchoRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EchoRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.U32 != 0 { + n += 1 + runtime.Sov(uint64(x.U32)) + } + if x.U64 != 0 { + n += 1 + runtime.Sov(uint64(x.U64)) + } + l = len(x.Str) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Bz) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Timestamp != nil { + l = options.Size(x.Timestamp) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Duration != nil { + l = options.Size(x.Duration) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.I32 != 0 { + n += 1 + runtime.Sov(uint64(x.I32)) + } + if x.I64 != 0 { + n += 1 + runtime.Sov(uint64(x.I64)) + } + if x.ABool { + n += 2 + } + if x.AnEnum != 0 { + n += 2 + runtime.Sov(uint64(x.AnEnum)) + } + if x.AMessage != nil { + l = options.Size(x.AMessage) + n += 2 + l + runtime.Sov(uint64(l)) + } + if x.ACoin != nil { + l = options.Size(x.ACoin) + n += 2 + l + runtime.Sov(uint64(l)) + } + l = len(x.AnAddress) + if l > 0 { + n += 2 + l + runtime.Sov(uint64(l)) + } + if x.Page != nil { + l = options.Size(x.Page) + n += 2 + l + runtime.Sov(uint64(l)) + } + if len(x.Bools) > 0 { + n += 2 + runtime.Sov(uint64(len(x.Bools))) + len(x.Bools)*1 + } + if len(x.Uints) > 0 { + l = 0 + for _, e := range x.Uints { + l += runtime.Sov(uint64(e)) + } + n += 2 + runtime.Sov(uint64(l)) + l + } + if len(x.Strings) > 0 { + for _, s := range x.Strings { + l = len(s) + n += 2 + l + runtime.Sov(uint64(l)) + } + } + if len(x.Enums) > 0 { + l = 0 + for _, e := range x.Enums { + l += runtime.Sov(uint64(e)) + } + n += 2 + runtime.Sov(uint64(l)) + l + } + if len(x.Durations) > 0 { + for _, e := range x.Durations { + l = options.Size(e) + n += 2 + l + runtime.Sov(uint64(l)) + } + } + if len(x.SomeMessages) > 0 { + for _, e := range x.SomeMessages { + l = options.Size(e) + n += 2 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EchoRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.SomeMessages) > 0 { + for iNdEx := len(x.SomeMessages) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.SomeMessages[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xd2 + } + } + if len(x.Durations) > 0 { + for iNdEx := len(x.Durations) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Durations[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xca + } + } + if len(x.Enums) > 0 { + var pksize2 int + for _, num := range x.Enums { + pksize2 += runtime.Sov(uint64(num)) + } + i -= pksize2 + j1 := i + for _, num1 := range x.Enums { + num := uint64(num1) + for num >= 1<<7 { + dAtA[j1] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j1++ + } + dAtA[j1] = uint8(num) + j1++ + } + i = runtime.EncodeVarint(dAtA, i, uint64(pksize2)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xc2 + } + if len(x.Strings) > 0 { + for iNdEx := len(x.Strings) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Strings[iNdEx]) + copy(dAtA[i:], x.Strings[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Strings[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xba + } + } + if len(x.Uints) > 0 { + var pksize4 int + for _, num := range x.Uints { + pksize4 += runtime.Sov(uint64(num)) + } + i -= pksize4 + j3 := i + for _, num := range x.Uints { + for num >= 1<<7 { + dAtA[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA[j3] = uint8(num) + j3++ + } + i = runtime.EncodeVarint(dAtA, i, uint64(pksize4)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xb2 + } + if len(x.Bools) > 0 { + for iNdEx := len(x.Bools) - 1; iNdEx >= 0; iNdEx-- { + i-- + if x.Bools[iNdEx] { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + } + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Bools))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa + } + if x.Page != nil { + encoded, err := options.Marshal(x.Page) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xa2 + } + if len(x.AnAddress) > 0 { + i -= len(x.AnAddress) + copy(dAtA[i:], x.AnAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AnAddress))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a + } + if x.ACoin != nil { + encoded, err := options.Marshal(x.ACoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x92 + } + if x.AMessage != nil { + encoded, err := options.Marshal(x.AMessage) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if x.AnEnum != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.AnEnum)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if x.ABool { + i-- + if x.ABool { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } + if x.I64 != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.I64)) + i-- + dAtA[i] = 0x50 + } + if x.I32 != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.I32)) + i-- + dAtA[i] = 0x38 + } + if x.Duration != nil { + encoded, err := options.Marshal(x.Duration) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + if x.Timestamp != nil { + encoded, err := options.Marshal(x.Timestamp) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x2a + } + if len(x.Bz) > 0 { + i -= len(x.Bz) + copy(dAtA[i:], x.Bz) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Bz))) + i-- + dAtA[i] = 0x22 + } + if len(x.Str) > 0 { + i -= len(x.Str) + copy(dAtA[i:], x.Str) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Str))) + i-- + dAtA[i] = 0x1a + } + if x.U64 != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.U64)) + i-- + dAtA[i] = 0x10 + } + if x.U32 != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.U32)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EchoRequest) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EchoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EchoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field U32", wireType) + } + x.U32 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.U32 |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field U64", wireType) + } + x.U64 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.U64 |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Str", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Str = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bz", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bz = append(x.Bz[:0], dAtA[iNdEx:postIndex]...) + if x.Bz == nil { + x.Bz = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Timestamp == nil { + x.Timestamp = ×tamppb.Timestamp{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Timestamp); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Duration == nil { + x.Duration = &durationpb.Duration{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Duration); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field I32", wireType) + } + x.I32 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.I32 |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field I64", wireType) + } + x.I64 = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.I64 |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ABool", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.ABool = bool(v != 0) + case 16: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AnEnum", wireType) + } + x.AnEnum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.AnEnum |= Enum(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.AMessage == nil { + x.AMessage = &AMessage{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AMessage); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 18: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ACoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.ACoin == nil { + x.ACoin = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ACoin); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 19: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AnAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.AnAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 20: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Page", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Page == nil { + x.Page = &v1beta11.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Page); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 21: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Bools = append(x.Bools, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(x.Bools) == 0 { + x.Bools = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Bools = append(x.Bools, bool(v != 0)) + } + } else { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bools", wireType) + } + case 22: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Uints = append(x.Uints, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(x.Uints) == 0 { + x.Uints = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Uints = append(x.Uints, v) + } + } else { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Uints", wireType) + } + case 23: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Strings = append(x.Strings, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 24: + if wireType == 0 { + var v Enum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= Enum(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Enums = append(x.Enums, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(x.Enums) == 0 { + x.Enums = make([]Enum, 0, elementCount) + } + for iNdEx < postIndex { + var v Enum + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= Enum(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Enums = append(x.Enums, v) + } + } else { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enums", wireType) + } + case 25: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Durations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Durations = append(x.Durations, &durationpb.Duration{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Durations[len(x.Durations)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 26: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SomeMessages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.SomeMessages = append(x.SomeMessages, &AMessage{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.SomeMessages[len(x.SomeMessages)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_AMessage protoreflect.MessageDescriptor + fd_AMessage_bar protoreflect.FieldDescriptor + fd_AMessage_baz protoreflect.FieldDescriptor +) + +func init() { + file_testpb_query_proto_init() + md_AMessage = File_testpb_query_proto.Messages().ByName("AMessage") + fd_AMessage_bar = md_AMessage.Fields().ByName("bar") + fd_AMessage_baz = md_AMessage.Fields().ByName("baz") +} + +var _ protoreflect.Message = (*fastReflection_AMessage)(nil) + +type fastReflection_AMessage AMessage + +func (x *AMessage) ProtoReflect() protoreflect.Message { + return (*fastReflection_AMessage)(x) +} + +func (x *AMessage) slowProtoReflect() protoreflect.Message { + mi := &file_testpb_query_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_AMessage_messageType fastReflection_AMessage_messageType +var _ protoreflect.MessageType = fastReflection_AMessage_messageType{} + +type fastReflection_AMessage_messageType struct{} + +func (x fastReflection_AMessage_messageType) Zero() protoreflect.Message { + return (*fastReflection_AMessage)(nil) +} +func (x fastReflection_AMessage_messageType) New() protoreflect.Message { + return new(fastReflection_AMessage) +} +func (x fastReflection_AMessage_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_AMessage +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_AMessage) Descriptor() protoreflect.MessageDescriptor { + return md_AMessage +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_AMessage) Type() protoreflect.MessageType { + return _fastReflection_AMessage_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_AMessage) New() protoreflect.Message { + return new(fastReflection_AMessage) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_AMessage) Interface() protoreflect.ProtoMessage { + return (*AMessage)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_AMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Bar != "" { + value := protoreflect.ValueOfString(x.Bar) + if !f(fd_AMessage_bar, value) { + return + } + } + if x.Baz != int32(0) { + value := protoreflect.ValueOfInt32(x.Baz) + if !f(fd_AMessage_baz, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_AMessage) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "testpb.AMessage.bar": + return x.Bar != "" + case "testpb.AMessage.baz": + return x.Baz != int32(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.AMessage")) + } + panic(fmt.Errorf("message testpb.AMessage does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_AMessage) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "testpb.AMessage.bar": + x.Bar = "" + case "testpb.AMessage.baz": + x.Baz = int32(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.AMessage")) + } + panic(fmt.Errorf("message testpb.AMessage does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_AMessage) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "testpb.AMessage.bar": + value := x.Bar + return protoreflect.ValueOfString(value) + case "testpb.AMessage.baz": + value := x.Baz + return protoreflect.ValueOfInt32(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.AMessage")) + } + panic(fmt.Errorf("message testpb.AMessage does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_AMessage) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "testpb.AMessage.bar": + x.Bar = value.Interface().(string) + case "testpb.AMessage.baz": + x.Baz = int32(value.Int()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.AMessage")) + } + panic(fmt.Errorf("message testpb.AMessage does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_AMessage) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "testpb.AMessage.bar": + panic(fmt.Errorf("field bar of message testpb.AMessage is not mutable")) + case "testpb.AMessage.baz": + panic(fmt.Errorf("field baz of message testpb.AMessage is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.AMessage")) + } + panic(fmt.Errorf("message testpb.AMessage does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_AMessage) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "testpb.AMessage.bar": + return protoreflect.ValueOfString("") + case "testpb.AMessage.baz": + return protoreflect.ValueOfInt32(int32(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.AMessage")) + } + panic(fmt.Errorf("message testpb.AMessage does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_AMessage) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in testpb.AMessage", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_AMessage) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_AMessage) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_AMessage) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_AMessage) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*AMessage) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Bar) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Baz != 0 { + n += 1 + runtime.Sov(uint64(x.Baz)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*AMessage) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Baz != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Baz)) + i-- + dAtA[i] = 0x10 + } + if len(x.Bar) > 0 { + i -= len(x.Bar) + copy(dAtA[i:], x.Bar) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Bar))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*AMessage) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Bar", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Bar = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Baz", wireType) + } + x.Baz = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Baz |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_EchoResponse protoreflect.MessageDescriptor + fd_EchoResponse_request protoreflect.FieldDescriptor +) + +func init() { + file_testpb_query_proto_init() + md_EchoResponse = File_testpb_query_proto.Messages().ByName("EchoResponse") + fd_EchoResponse_request = md_EchoResponse.Fields().ByName("request") +} + +var _ protoreflect.Message = (*fastReflection_EchoResponse)(nil) + +type fastReflection_EchoResponse EchoResponse + +func (x *EchoResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_EchoResponse)(x) +} + +func (x *EchoResponse) slowProtoReflect() protoreflect.Message { + mi := &file_testpb_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_EchoResponse_messageType fastReflection_EchoResponse_messageType +var _ protoreflect.MessageType = fastReflection_EchoResponse_messageType{} + +type fastReflection_EchoResponse_messageType struct{} + +func (x fastReflection_EchoResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_EchoResponse)(nil) +} +func (x fastReflection_EchoResponse_messageType) New() protoreflect.Message { + return new(fastReflection_EchoResponse) +} +func (x fastReflection_EchoResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EchoResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EchoResponse) Descriptor() protoreflect.MessageDescriptor { + return md_EchoResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_EchoResponse) Type() protoreflect.MessageType { + return _fastReflection_EchoResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EchoResponse) New() protoreflect.Message { + return new(fastReflection_EchoResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EchoResponse) Interface() protoreflect.ProtoMessage { + return (*EchoResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_EchoResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Request != nil { + value := protoreflect.ValueOfMessage(x.Request.ProtoReflect()) + if !f(fd_EchoResponse_request, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_EchoResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "testpb.EchoResponse.request": + return x.Request != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoResponse")) + } + panic(fmt.Errorf("message testpb.EchoResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "testpb.EchoResponse.request": + x.Request = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoResponse")) + } + panic(fmt.Errorf("message testpb.EchoResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_EchoResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "testpb.EchoResponse.request": + value := x.Request + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoResponse")) + } + panic(fmt.Errorf("message testpb.EchoResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "testpb.EchoResponse.request": + x.Request = value.Message().Interface().(*EchoRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoResponse")) + } + panic(fmt.Errorf("message testpb.EchoResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "testpb.EchoResponse.request": + if x.Request == nil { + x.Request = new(EchoRequest) + } + return protoreflect.ValueOfMessage(x.Request.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoResponse")) + } + panic(fmt.Errorf("message testpb.EchoResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_EchoResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "testpb.EchoResponse.request": + m := new(EchoRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoResponse")) + } + panic(fmt.Errorf("message testpb.EchoResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_EchoResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in testpb.EchoResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_EchoResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_EchoResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_EchoResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_EchoResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EchoResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Request != nil { + l = options.Size(x.Request) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*EchoResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Request != nil { + encoded, err := options.Marshal(x.Request) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*EchoResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, 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 protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EchoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EchoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Request == nil { + x.Request = &EchoRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Request); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: testpb/query.proto + +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) +) + +type Enum int32 + +const ( + Enum_ENUM_UNSPECIFIED Enum = 0 + Enum_ENUM_ONE Enum = 1 + Enum_ENUM_TWO Enum = 2 + Enum_ENUM_FIVE Enum = 5 + Enum_ENUM_NEG_THREE Enum = -3 +) + +// Enum value maps for Enum. +var ( + Enum_name = map[int32]string{ + 0: "ENUM_UNSPECIFIED", + 1: "ENUM_ONE", + 2: "ENUM_TWO", + 5: "ENUM_FIVE", + -3: "ENUM_NEG_THREE", + } + Enum_value = map[string]int32{ + "ENUM_UNSPECIFIED": 0, + "ENUM_ONE": 1, + "ENUM_TWO": 2, + "ENUM_FIVE": 5, + "ENUM_NEG_THREE": -3, + } +) + +func (x Enum) Enum() *Enum { + p := new(Enum) + *p = x + return p +} + +func (x Enum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Enum) Descriptor() protoreflect.EnumDescriptor { + return file_testpb_query_proto_enumTypes[0].Descriptor() +} + +func (Enum) Type() protoreflect.EnumType { + return &file_testpb_query_proto_enumTypes[0] +} + +func (x Enum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Enum.Descriptor instead. +func (Enum) EnumDescriptor() ([]byte, []int) { + return file_testpb_query_proto_rawDescGZIP(), []int{0} +} + +type EchoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // u32 is an uint32 + U32 uint32 `protobuf:"varint,1,opt,name=u32,proto3" json:"u32,omitempty"` + U64 uint64 `protobuf:"varint,2,opt,name=u64,proto3" json:"u64,omitempty"` + Str string `protobuf:"bytes,3,opt,name=str,proto3" json:"str,omitempty"` + Bz []byte `protobuf:"bytes,4,opt,name=bz,proto3" json:"bz,omitempty"` + Timestamp *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Duration *durationpb.Duration `protobuf:"bytes,6,opt,name=duration,proto3" json:"duration,omitempty"` + I32 int32 `protobuf:"varint,7,opt,name=i32,proto3" json:"i32,omitempty"` + I64 int64 `protobuf:"varint,10,opt,name=i64,proto3" json:"i64,omitempty"` + ABool bool `protobuf:"varint,15,opt,name=a_bool,json=aBool,proto3" json:"a_bool,omitempty"` + AnEnum Enum `protobuf:"varint,16,opt,name=an_enum,json=anEnum,proto3,enum=testpb.Enum" json:"an_enum,omitempty"` + AMessage *AMessage `protobuf:"bytes,17,opt,name=a_message,json=aMessage,proto3" json:"a_message,omitempty"` + ACoin *v1beta1.Coin `protobuf:"bytes,18,opt,name=a_coin,json=aCoin,proto3" json:"a_coin,omitempty"` + AnAddress string `protobuf:"bytes,19,opt,name=an_address,json=anAddress,proto3" json:"an_address,omitempty"` + Page *v1beta11.PageRequest `protobuf:"bytes,20,opt,name=page,proto3" json:"page,omitempty"` + Bools []bool `protobuf:"varint,21,rep,packed,name=bools,proto3" json:"bools,omitempty"` + Uints []uint32 `protobuf:"varint,22,rep,packed,name=uints,proto3" json:"uints,omitempty"` + Strings []string `protobuf:"bytes,23,rep,name=strings,proto3" json:"strings,omitempty"` + Enums []Enum `protobuf:"varint,24,rep,packed,name=enums,proto3,enum=testpb.Enum" json:"enums,omitempty"` + Durations []*durationpb.Duration `protobuf:"bytes,25,rep,name=durations,proto3" json:"durations,omitempty"` + SomeMessages []*AMessage `protobuf:"bytes,26,rep,name=some_messages,json=someMessages,proto3" json:"some_messages,omitempty"` +} + +func (x *EchoRequest) Reset() { + *x = EchoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EchoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EchoRequest) ProtoMessage() {} + +// Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead. +func (*EchoRequest) Descriptor() ([]byte, []int) { + return file_testpb_query_proto_rawDescGZIP(), []int{0} +} + +func (x *EchoRequest) GetU32() uint32 { + if x != nil { + return x.U32 + } + return 0 +} + +func (x *EchoRequest) GetU64() uint64 { + if x != nil { + return x.U64 + } + return 0 +} + +func (x *EchoRequest) GetStr() string { + if x != nil { + return x.Str + } + return "" +} + +func (x *EchoRequest) GetBz() []byte { + if x != nil { + return x.Bz + } + return nil +} + +func (x *EchoRequest) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +func (x *EchoRequest) GetDuration() *durationpb.Duration { + if x != nil { + return x.Duration + } + return nil +} + +func (x *EchoRequest) GetI32() int32 { + if x != nil { + return x.I32 + } + return 0 +} + +func (x *EchoRequest) GetI64() int64 { + if x != nil { + return x.I64 + } + return 0 +} + +func (x *EchoRequest) GetABool() bool { + if x != nil { + return x.ABool + } + return false +} + +func (x *EchoRequest) GetAnEnum() Enum { + if x != nil { + return x.AnEnum + } + return Enum_ENUM_UNSPECIFIED +} + +func (x *EchoRequest) GetAMessage() *AMessage { + if x != nil { + return x.AMessage + } + return nil +} + +func (x *EchoRequest) GetACoin() *v1beta1.Coin { + if x != nil { + return x.ACoin + } + return nil +} + +func (x *EchoRequest) GetAnAddress() string { + if x != nil { + return x.AnAddress + } + return "" +} + +func (x *EchoRequest) GetPage() *v1beta11.PageRequest { + if x != nil { + return x.Page + } + return nil +} + +func (x *EchoRequest) GetBools() []bool { + if x != nil { + return x.Bools + } + return nil +} + +func (x *EchoRequest) GetUints() []uint32 { + if x != nil { + return x.Uints + } + return nil +} + +func (x *EchoRequest) GetStrings() []string { + if x != nil { + return x.Strings + } + return nil +} + +func (x *EchoRequest) GetEnums() []Enum { + if x != nil { + return x.Enums + } + return nil +} + +func (x *EchoRequest) GetDurations() []*durationpb.Duration { + if x != nil { + return x.Durations + } + return nil +} + +func (x *EchoRequest) GetSomeMessages() []*AMessage { + if x != nil { + return x.SomeMessages + } + return nil +} + +type AMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Bar string `protobuf:"bytes,1,opt,name=bar,proto3" json:"bar,omitempty"` + Baz int32 `protobuf:"varint,2,opt,name=baz,proto3" json:"baz,omitempty"` +} + +func (x *AMessage) Reset() { + *x = AMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AMessage) ProtoMessage() {} + +// Deprecated: Use AMessage.ProtoReflect.Descriptor instead. +func (*AMessage) Descriptor() ([]byte, []int) { + return file_testpb_query_proto_rawDescGZIP(), []int{1} +} + +func (x *AMessage) GetBar() string { + if x != nil { + return x.Bar + } + return "" +} + +func (x *AMessage) GetBaz() int32 { + if x != nil { + return x.Baz + } + return 0 +} + +type EchoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Request *EchoRequest `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` +} + +func (x *EchoResponse) Reset() { + *x = EchoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_testpb_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EchoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EchoResponse) ProtoMessage() {} + +// Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead. +func (*EchoResponse) Descriptor() ([]byte, []int) { + return file_testpb_query_proto_rawDescGZIP(), []int{2} +} + +func (x *EchoResponse) GetRequest() *EchoRequest { + if x != nil { + return x.Request + } + return nil +} + +var File_testpb_query_proto protoreflect.FileDescriptor + +var file_testpb_query_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x1a, 0x1f, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, + 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x05, 0x0a, 0x0b, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x33, 0x32, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x03, 0x75, 0x33, 0x32, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x36, 0x34, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x03, 0x75, 0x36, 0x34, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x62, 0x7a, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x62, 0x7a, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x35, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x69, + 0x33, 0x32, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x69, 0x33, 0x32, 0x12, 0x10, 0x0a, + 0x03, 0x69, 0x36, 0x34, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x69, 0x36, 0x34, 0x12, + 0x15, 0x0a, 0x06, 0x61, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x61, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x25, 0x0a, 0x07, 0x61, 0x6e, 0x5f, 0x65, 0x6e, 0x75, + 0x6d, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x06, 0x61, 0x6e, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x2d, 0x0a, + 0x09, 0x61, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x41, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x52, 0x08, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x06, + 0x61, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x61, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x37, + 0x0a, 0x0a, 0x61, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x13, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x6e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3a, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x04, 0x70, + 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x15, 0x20, 0x03, + 0x28, 0x08, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x69, 0x6e, + 0x74, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x05, 0x75, 0x69, 0x6e, 0x74, 0x73, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x17, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x6e, 0x75, + 0x6d, 0x73, 0x18, 0x18, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, + 0x62, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x05, 0x65, 0x6e, 0x75, 0x6d, 0x73, 0x12, 0x37, 0x0a, + 0x09, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x0d, 0x73, 0x6f, 0x6d, 0x65, 0x5f, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, + 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x41, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, + 0x0c, 0x73, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x2e, 0x0a, + 0x08, 0x41, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x61, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62, 0x61, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x62, + 0x61, 0x7a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x62, 0x61, 0x7a, 0x22, 0x3d, 0x0a, + 0x0c, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a, + 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, + 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x52, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2a, 0x64, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x55, 0x4e, 0x53, + 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x4e, + 0x55, 0x4d, 0x5f, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x4e, 0x55, 0x4d, + 0x5f, 0x54, 0x57, 0x4f, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x46, + 0x49, 0x56, 0x45, 0x10, 0x05, 0x12, 0x1b, 0x0a, 0x0e, 0x45, 0x4e, 0x55, 0x4d, 0x5f, 0x4e, 0x45, + 0x47, 0x5f, 0x54, 0x48, 0x52, 0x45, 0x45, 0x10, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x32, 0x3a, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x31, 0x0a, 0x04, 0x45, + 0x63, 0x68, 0x6f, 0x12, 0x13, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x45, 0x63, 0x68, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, + 0x62, 0x2e, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x88, + 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x42, 0x0a, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x74, 0x65, 0x73, + 0x74, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x54, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, + 0x70, 0x62, 0xca, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0xe2, 0x02, 0x12, 0x54, 0x65, + 0x73, 0x74, 0x70, 0x62, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x06, 0x54, 0x65, 0x73, 0x74, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_testpb_query_proto_rawDescOnce sync.Once + file_testpb_query_proto_rawDescData = file_testpb_query_proto_rawDesc +) + +func file_testpb_query_proto_rawDescGZIP() []byte { + file_testpb_query_proto_rawDescOnce.Do(func() { + file_testpb_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_testpb_query_proto_rawDescData) + }) + return file_testpb_query_proto_rawDescData +} + +var file_testpb_query_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_testpb_query_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_testpb_query_proto_goTypes = []interface{}{ + (Enum)(0), // 0: testpb.Enum + (*EchoRequest)(nil), // 1: testpb.EchoRequest + (*AMessage)(nil), // 2: testpb.AMessage + (*EchoResponse)(nil), // 3: testpb.EchoResponse + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 5: google.protobuf.Duration + (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin + (*v1beta11.PageRequest)(nil), // 7: cosmos.base.query.v1beta1.PageRequest +} +var file_testpb_query_proto_depIdxs = []int32{ + 4, // 0: testpb.EchoRequest.timestamp:type_name -> google.protobuf.Timestamp + 5, // 1: testpb.EchoRequest.duration:type_name -> google.protobuf.Duration + 0, // 2: testpb.EchoRequest.an_enum:type_name -> testpb.Enum + 2, // 3: testpb.EchoRequest.a_message:type_name -> testpb.AMessage + 6, // 4: testpb.EchoRequest.a_coin:type_name -> cosmos.base.v1beta1.Coin + 7, // 5: testpb.EchoRequest.page:type_name -> cosmos.base.query.v1beta1.PageRequest + 0, // 6: testpb.EchoRequest.enums:type_name -> testpb.Enum + 5, // 7: testpb.EchoRequest.durations:type_name -> google.protobuf.Duration + 2, // 8: testpb.EchoRequest.some_messages:type_name -> testpb.AMessage + 1, // 9: testpb.EchoResponse.request:type_name -> testpb.EchoRequest + 1, // 10: testpb.Query.Echo:input_type -> testpb.EchoRequest + 3, // 11: testpb.Query.Echo:output_type -> testpb.EchoResponse + 11, // [11:12] is the sub-list for method output_type + 10, // [10:11] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_testpb_query_proto_init() } +func file_testpb_query_proto_init() { + if File_testpb_query_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_testpb_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EchoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_testpb_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EchoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_testpb_query_proto_rawDesc, + NumEnums: 1, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_testpb_query_proto_goTypes, + DependencyIndexes: file_testpb_query_proto_depIdxs, + EnumInfos: file_testpb_query_proto_enumTypes, + MessageInfos: file_testpb_query_proto_msgTypes, + }.Build() + File_testpb_query_proto = out.File + file_testpb_query_proto_rawDesc = nil + file_testpb_query_proto_goTypes = nil + file_testpb_query_proto_depIdxs = nil +} diff --git a/client/v2/internal/testpb/query_grpc.pb.go b/client/v2/internal/testpb/query_grpc.pb.go new file mode 100644 index 0000000000..56d177ddc8 --- /dev/null +++ b/client/v2/internal/testpb/query_grpc.pb.go @@ -0,0 +1,107 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc (unknown) +// source: testpb/query.proto + +package testpb + +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 + +// QueryClient is the client API for Query 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 QueryClient interface { + // Echo returns the request in the response + Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) +} + +type queryClient struct { + cc grpc.ClientConnInterface +} + +func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) { + out := new(EchoResponse) + err := c.cc.Invoke(ctx, "/testpb.Query/Echo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +// All implementations must embed UnimplementedQueryServer +// for forward compatibility +type QueryServer interface { + // Echo returns the request in the response + Echo(context.Context, *EchoRequest) (*EchoResponse, error) + mustEmbedUnimplementedQueryServer() +} + +// UnimplementedQueryServer must be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (UnimplementedQueryServer) Echo(context.Context, *EchoRequest) (*EchoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") +} +func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} + +// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to QueryServer will +// result in compilation errors. +type UnsafeQueryServer interface { + mustEmbedUnimplementedQueryServer() +} + +func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { + s.RegisterService(&Query_ServiceDesc, srv) +} + +func _Query_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EchoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Echo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/testpb.Query/Echo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Echo(ctx, req.(*EchoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Query_ServiceDesc is the grpc.ServiceDesc for Query service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Query_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "testpb.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Echo", + Handler: _Query_Echo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "testpb/query.proto", +} diff --git a/client/v2/internal/util/util.go b/client/v2/internal/util/util.go new file mode 100644 index 0000000000..18b8d53006 --- /dev/null +++ b/client/v2/internal/util/util.go @@ -0,0 +1,29 @@ +package util + +import ( + "github.com/iancoleman/strcase" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/dynamicpb" +) + +func DescriptorKebabName(descriptor protoreflect.Descriptor) string { + return strcase.ToKebab(string(descriptor.Name())) +} + +func DescriptorDocs(descriptor protoreflect.Descriptor) string { + return descriptor.ParentFile().SourceLocations().ByDescriptor(descriptor).LeadingComments +} + +func ResolveMessageType(resolver protoregistry.MessageTypeResolver, descriptor protoreflect.MessageDescriptor) protoreflect.MessageType { + if resolver == nil { + resolver = protoregistry.GlobalTypes + } + + typ, err := resolver.FindMessageByName(descriptor.FullName()) + if err == nil { + return typ + } + + return dynamicpb.NewMessageType(descriptor) +}