diff --git a/client/v2/autocli/flag/field.go b/client/v2/autocli/flag/field.go index 40577e4ee7..19f0abd8b1 100644 --- a/client/v2/autocli/flag/field.go +++ b/client/v2/autocli/flag/field.go @@ -2,13 +2,15 @@ package flag import ( "context" + "strconv" - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - cosmos_proto "github.com/cosmos/cosmos-proto" "github.com/spf13/pflag" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + cosmos_proto "github.com/cosmos/cosmos-proto" + "cosmossdk.io/client/v2/internal/util" ) @@ -60,8 +62,13 @@ func (b *Builder) addFieldFlag(ctx context.Context, flagSet *pflag.FlagSet, fiel // use the built-in pflag StringP, Int32P, etc. functions var val HasValue + if field.IsList() { val = bindSimpleListFlag(flagSet, field.Kind(), name, shorthand, usage) + } else if field.IsMap() { + keyKind := field.MapKey().Kind() + valKind := field.MapValue().Kind() + val = bindSimpleMapFlag(flagSet, keyKind, valKind, name, shorthand, usage) } else { val = bindSimpleFlag(flagSet, field.Kind(), name, shorthand, usage) } @@ -81,7 +88,65 @@ func (b *Builder) resolveFlagType(field protoreflect.FieldDescriptor) Type { if typ != nil { return compositeListType{simpleType: typ} } + return nil + } + if field.IsMap() { + keyKind := field.MapKey().Kind() + valType := b.resolveFlagType(field.MapValue()) + if valType != nil { + switch keyKind { + case protoreflect.StringKind: + ct := new(compositeMapType[string]) + ct.keyValueResolver = func(s string) (string, error) { return s, nil } + ct.valueType = valType + ct.keyType = "string" + return ct + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + ct := new(compositeMapType[int32]) + ct.keyValueResolver = func(s string) (int32, error) { + i, err := strconv.ParseInt(s, 10, 32) + return int32(i), err + } + ct.valueType = valType + ct.keyType = "int32" + return ct + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + ct := new(compositeMapType[int64]) + ct.keyValueResolver = func(s string) (int64, error) { + i, err := strconv.ParseInt(s, 10, 64) + return i, err + } + ct.valueType = valType + ct.keyType = "int64" + return ct + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + ct := new(compositeMapType[uint32]) + ct.keyValueResolver = func(s string) (uint32, error) { + i, err := strconv.ParseUint(s, 10, 32) + return uint32(i), err + } + ct.valueType = valType + ct.keyType = "uint32" + return ct + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + ct := new(compositeMapType[uint64]) + ct.keyValueResolver = func(s string) (uint64, error) { + i, err := strconv.ParseUint(s, 10, 64) + return i, err + } + ct.valueType = valType + ct.keyType = "uint64" + return ct + case protoreflect.BoolKind: + ct := new(compositeMapType[bool]) + ct.keyValueResolver = strconv.ParseBool + ct.valueType = valType + ct.keyType = "bool" + return ct + } + return nil + } return nil } @@ -107,7 +172,6 @@ func (b *Builder) resolveFlagTypeBasic(field protoreflect.FieldDescriptor) Type if flagType, ok := b.messageFlagTypes[field.Message().FullName()]; ok { return flagType } - return jsonMessageFlagType{ messageDesc: field.Message(), } diff --git a/client/v2/autocli/flag/map.go b/client/v2/autocli/flag/map.go new file mode 100644 index 0000000000..66b30e0a78 --- /dev/null +++ b/client/v2/autocli/flag/map.go @@ -0,0 +1,252 @@ +package flag + +import ( + "context" + "fmt" + "strings" + + "github.com/cockroachdb/errors" + "github.com/spf13/pflag" + "google.golang.org/protobuf/reflect/protoreflect" +) + +func bindSimpleMapFlag(flagSet *pflag.FlagSet, keyKind, valueKind protoreflect.Kind, name, shorthand, usage string) HasValue { + switch keyKind { + case protoreflect.StringKind: + switch valueKind { + case protoreflect.StringKind: + val := flagSet.StringToStringP(name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfString) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := StringToInt32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt32) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := flagSet.StringToInt64P(name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt64) + case protoreflect.Uint32Kind: + val := StringToUint32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint32) + case protoreflect.Uint64Kind: + val := StringToUint64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint64) + case protoreflect.BoolKind: + val := StringToBoolP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfBool) + } + + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + switch valueKind { + case protoreflect.StringKind: + val := Int32ToStringP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfString) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := Int32ToInt32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt32) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := Int32ToInt64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt64) + case protoreflect.Uint32Kind: + val := Int32ToUint32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint32) + case protoreflect.Uint64Kind: + val := Int32ToUint64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint64) + case protoreflect.BoolKind: + val := Int32ToBoolP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfBool) + } + + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + switch valueKind { + case protoreflect.StringKind: + val := Int64ToStringP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfString) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := Int64ToInt32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt32) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := Int64ToInt64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt64) + case protoreflect.Uint32Kind: + val := Int64ToUint32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint32) + case protoreflect.Uint64Kind: + val := Int64ToUint64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint64) + case protoreflect.BoolKind: + val := Int64ToBoolP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfBool) + } + case protoreflect.Uint32Kind: + switch valueKind { + case protoreflect.StringKind: + val := Uint32ToStringP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfString) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := Uint32ToInt32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt32) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := Uint32ToInt64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt64) + case protoreflect.Uint32Kind: + val := Uint32ToUint32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint32) + case protoreflect.Uint64Kind: + val := Uint32ToUint64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint64) + case protoreflect.BoolKind: + val := Uint32ToBoolP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfBool) + } + case protoreflect.Uint64Kind: + switch valueKind { + case protoreflect.StringKind: + val := Uint64ToStringP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfString) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := Uint64ToInt32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt32) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := Uint64ToInt64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt64) + case protoreflect.Uint32Kind: + val := Uint64ToUint32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint32) + case protoreflect.Uint64Kind: + val := Uint64ToUint64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint64) + case protoreflect.BoolKind: + val := Uint64ToBoolP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfBool) + } + case protoreflect.BoolKind: + switch valueKind { + case protoreflect.StringKind: + val := BoolToStringP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfString) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + val := BoolToInt32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt32) + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + val := BoolToInt64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfInt64) + case protoreflect.Uint32Kind: + val := BoolToUint32P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint32) + case protoreflect.Uint64Kind: + val := BoolToUint64P(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfUint64) + case protoreflect.BoolKind: + val := BoolToBoolP(flagSet, name, shorthand, nil, usage) + return newMapValue(val, protoreflect.ValueOfBool) + } + + } + return nil +} + +type mapValue[K comparable, V any] struct { + value *map[K]V + toProtoreflectValue func(V) protoreflect.Value +} + +func newMapValue[K comparable, V any](mapV *map[K]V, toProtoreflectValue func(V) protoreflect.Value) mapValue[K, V] { + return mapValue[K, V]{value: mapV, toProtoreflectValue: toProtoreflectValue} +} + +func (v mapValue[K, V]) Get(mutable protoreflect.Value) (protoreflect.Value, error) { + protoMap := mutable.Map() + for k, val := range *v.value { + protoMap.Set(protoreflect.MapKey(protoreflect.ValueOf(k)), v.toProtoreflectValue(val)) + } + return mutable, nil +} + +// keyValueResolver is a function that converts a string to a key that is primitive Type T +type keyValueResolver[T comparable] func(string) (T, error) + +// compositeMapType is a map type that is composed of a key and value type that are both primitive types +type compositeMapType[T comparable] struct { + keyValueResolver keyValueResolver[T] + keyType string + valueType Type +} + +// compositeMapValue is a map value that is composed of a key and value type that are both primitive types +type compositeMapValue[T comparable] struct { + keyValueResolver keyValueResolver[T] + keyType string + valueType Type + values map[T]protoreflect.Value + ctx context.Context + opts *Builder +} + +func (m compositeMapType[T]) DefaultValue() string { + return "" +} + +func (m compositeMapType[T]) NewValue(ctx context.Context, opts *Builder) Value { + return &compositeMapValue[T]{ + keyValueResolver: m.keyValueResolver, + valueType: m.valueType, + keyType: m.keyType, + ctx: ctx, + opts: opts, + values: nil, + } +} + +func (m *compositeMapValue[T]) Set(s string) error { + comaArgs := strings.Split(s, ",") + for _, arg := range comaArgs { + parts := strings.SplitN(arg, "=", 2) + if len(parts) != 2 { + return errors.New("invalid format, expected key=value") + } + key, val := parts[0], parts[1] + + keyValue, err := m.keyValueResolver(key) + if err != nil { + return err + } + + simpleVal := m.valueType.NewValue(m.ctx, m.opts) + err = simpleVal.Set(val) + if err != nil { + return err + } + protoValue, err := simpleVal.Get(protoreflect.Value{}) + if err != nil { + return err + } + if m.values == nil { + m.values = make(map[T]protoreflect.Value) + } + + m.values[keyValue] = protoValue + } + + return nil +} + +func (m *compositeMapValue[T]) Get(mutable protoreflect.Value) (protoreflect.Value, error) { + protoMap := mutable.Map() + for key, value := range m.values { + keyVal := protoreflect.ValueOf(key) + protoMap.Set(keyVal.MapKey(), value) + } + return protoreflect.ValueOfMap(protoMap), nil +} + +func (m *compositeMapValue[T]) String() string { + if m.values == nil { + return "" + } + + return fmt.Sprintf("%+v", m.values) +} + +func (m *compositeMapValue[T]) Type() string { + return fmt.Sprintf("map[%s]%s", m.keyType, m.valueType.NewValue(m.ctx, m.opts).Type()) +} diff --git a/client/v2/autocli/flag/map_bool_to_value.go b/client/v2/autocli/flag/map_bool_to_value.go new file mode 100644 index 0000000000..5f9406db34 --- /dev/null +++ b/client/v2/autocli/flag/map_bool_to_value.go @@ -0,0 +1,138 @@ +package flag + +import ( + "strconv" + + "github.com/spf13/pflag" +) + +func newBoolToString[K bool, V string](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newBoolStringMap := newGenericMapValue(val, p) + newBoolStringMap.Options = genericMapValueOptions[K, V]{ + genericType: "boolToString", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseBool(s) + return K(value), err + }, + valueParser: func(s string) (V, error) { + return V(s), nil + }, + } + return newBoolStringMap +} + +func BoolToStringP(flagSet *pflag.FlagSet, name, shorthand string, value map[bool]string, usage string) *map[bool]string { + p := make(map[bool]string) + flagSet.VarP(newBoolToString(value, &p), name, shorthand, usage) + return &p +} + +func newBoolToInt32[K bool, V int32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newBoolInt32Map := newGenericMapValue(val, p) + newBoolInt32Map.Options = genericMapValueOptions[K, V]{ + genericType: "boolToInt32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseBool(s) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 32) + return V(value), err + }, + } + return newBoolInt32Map +} + +func BoolToInt32P(flagSet *pflag.FlagSet, name, shorthand string, value map[bool]int32, usage string) *map[bool]int32 { + p := make(map[bool]int32) + flagSet.VarP(newBoolToInt32(value, &p), name, shorthand, usage) + return &p +} + +func newBoolToInt64[K bool, V int64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newBoolInt64Map := newGenericMapValue(val, p) + newBoolInt64Map.Options = genericMapValueOptions[K, V]{ + genericType: "boolToInt64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseBool(s) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 64) + return V(value), err + }, + } + return newBoolInt64Map +} + +func BoolToInt64P(flagSet *pflag.FlagSet, name, shorthand string, value map[bool]int64, usage string) *map[bool]int64 { + p := make(map[bool]int64) + flagSet.VarP(newBoolToInt64(value, &p), name, shorthand, usage) + return &p +} + +func newBoolToUint32[K bool, V uint32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newBoolUint32Map := newGenericMapValue(val, p) + newBoolUint32Map.Options = genericMapValueOptions[K, V]{ + genericType: "boolToUint32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseBool(s) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 32) + return V(value), err + }, + } + return newBoolUint32Map +} + +func BoolToUint32P(flagSet *pflag.FlagSet, name, shorthand string, value map[bool]uint32, usage string) *map[bool]uint32 { + p := make(map[bool]uint32) + flagSet.VarP(newBoolToUint32(value, &p), name, shorthand, usage) + return &p +} + +func newBoolToUint64[K bool, V uint64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newBoolUint64Map := newGenericMapValue(val, p) + newBoolUint64Map.Options = genericMapValueOptions[K, V]{ + genericType: "boolToUint64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseBool(s) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 64) + return V(value), err + }, + } + return newBoolUint64Map +} + +func BoolToUint64P(flagSet *pflag.FlagSet, name, shorthand string, value map[bool]uint64, usage string) *map[bool]uint64 { + p := make(map[bool]uint64) + flagSet.VarP(newBoolToUint64(value, &p), name, shorthand, usage) + return &p +} + +func newBoolToBool[K, V bool](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newBoolBoolMap := newGenericMapValue(val, p) + newBoolBoolMap.Options = genericMapValueOptions[K, V]{ + genericType: "boolToBool", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseBool(s) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseBool(s) + return V(value), err + }, + } + return newBoolBoolMap +} + +func BoolToBoolP(flagSet *pflag.FlagSet, name, shorthand string, value map[bool]bool, usage string) *map[bool]bool { + p := make(map[bool]bool) + flagSet.VarP(newBoolToBool(value, &p), name, shorthand, usage) + return &p +} diff --git a/client/v2/autocli/flag/map_int32_to_value.go b/client/v2/autocli/flag/map_int32_to_value.go new file mode 100644 index 0000000000..a2af9d3807 --- /dev/null +++ b/client/v2/autocli/flag/map_int32_to_value.go @@ -0,0 +1,159 @@ +package flag + +import ( + "strconv" + + "github.com/spf13/pflag" +) + +func newInt32ToString[K int32, V string](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt32StringMap := newGenericMapValue(val, p) + newInt32StringMap.Options = genericMapValueOptions[K, V]{ + genericType: "int32ToString", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + return V(s), nil + }, + } + return newInt32StringMap +} + +func Int32ToStringP(flagSet *pflag.FlagSet, name, shorthand string, value map[int32]string, usage string) *map[int32]string { + p := make(map[int32]string) + flagSet.VarP(newInt32ToString(value, &p), name, shorthand, usage) + return &p +} + +func newInt32ToInt32[K, V int32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt32Int32Map := newGenericMapValue(val, p) + newInt32Int32Map.Options = genericMapValueOptions[K, V]{ + genericType: "int32ToInt32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 32) + return V(value), err + }, + } + return newInt32Int32Map +} + +func Int32ToInt32P(flagSet *pflag.FlagSet, name, shorthand string, value map[int32]int32, usage string) *map[int32]int32 { + p := make(map[int32]int32) + flagSet.VarP(newInt32ToInt32(value, &p), name, shorthand, usage) + return &p +} + +func newInt32ToInt64[K int32, V int64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt32Int64Map := newGenericMapValue(val, p) + newInt32Int64Map.Options = genericMapValueOptions[K, V]{ + genericType: "int32ToInt64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 64) + return V(value), err + }, + } + return newInt32Int64Map +} + +func Int32ToInt64P(flagSet *pflag.FlagSet, name, shorthand string, value map[int32]int64, usage string) *map[int32]int64 { + p := make(map[int32]int64) + flagSet.VarP(newInt32ToInt64(value, &p), name, shorthand, usage) + return &p +} + +func newInt32ToUint32[K int32, V uint32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt32Uint32Map := newGenericMapValue(val, p) + newInt32Uint32Map.Options = genericMapValueOptions[K, V]{ + genericType: "int32ToUint32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 32) + return V(value), err + }, + } + return newInt32Uint32Map +} + +func Int32ToUint32P(flagSet *pflag.FlagSet, name, shorthand string, value map[int32]uint32, usage string) *map[int32]uint32 { + p := make(map[int32]uint32) + flagSet.VarP(newInt32ToUint32(value, &p), name, shorthand, usage) + return &p +} + +func newInt32ToUint64[K int32, V uint64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt32Uint64Map := newGenericMapValue(val, p) + newInt32Uint64Map.Options = genericMapValueOptions[K, V]{ + genericType: "int32ToUint64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 64) + return V(value), err + }, + } + return newInt32Uint64Map +} + +func Int32ToUint64P(flagSet *pflag.FlagSet, name, shorthand string, value map[int32]uint64, usage string) *map[int32]uint64 { + p := make(map[int32]uint64) + flagSet.VarP(newInt32ToUint64(value, &p), name, shorthand, usage) + return &p +} + +func newInt32ToBool[K int32, V bool](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt32BoolMap := newGenericMapValue(val, p) + newInt32BoolMap.Options = genericMapValueOptions[K, V]{ + genericType: "int32ToBool", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseBool(s) + return V(value), err + }, + } + return newInt32BoolMap +} + +func Int32ToBoolP(flagSet *pflag.FlagSet, name, shorthand string, value map[int32]bool, usage string) *map[int32]bool { + p := make(map[int32]bool) + flagSet.VarP(newInt32ToBool(value, &p), name, shorthand, usage) + return &p +} + +func newStringToBool[K string, V bool](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newStringBoolMap := newGenericMapValue(val, p) + newStringBoolMap.Options = genericMapValueOptions[K, V]{ + genericType: "stringToBool", + keyParser: func(s string) (K, error) { + return K(s), nil + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseBool(s) + return V(value), err + }, + } + return newStringBoolMap +} + +func StringToBoolP(flagSet *pflag.FlagSet, name, shorthand string, value map[string]bool, usage string) *map[string]bool { + p := make(map[string]bool) + flagSet.VarP(newStringToBool(value, &p), name, shorthand, usage) + return &p +} diff --git a/client/v2/autocli/flag/map_int64_to_value.go b/client/v2/autocli/flag/map_int64_to_value.go new file mode 100644 index 0000000000..06bd46770e --- /dev/null +++ b/client/v2/autocli/flag/map_int64_to_value.go @@ -0,0 +1,180 @@ +package flag + +import ( + "strconv" + + "github.com/spf13/pflag" +) + +func newInt64ToString[K int64, V string](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt64StringMap := newGenericMapValue(val, p) + newInt64StringMap.Options = genericMapValueOptions[K, V]{ + genericType: "int64ToString", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + return V(s), nil + }, + } + return newInt64StringMap +} + +func Int64ToStringP(flagSet *pflag.FlagSet, name, shorthand string, value map[int64]string, usage string) *map[int64]string { + p := make(map[int64]string) + flagSet.VarP(newInt64ToString(value, &p), name, shorthand, usage) + return &p +} + +func newInt64ToInt32[K int64, V int32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt64Int32Map := newGenericMapValue(val, p) + newInt64Int32Map.Options = genericMapValueOptions[K, V]{ + genericType: "int64ToInt32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 32) + return V(value), err + }, + } + return newInt64Int32Map +} + +func Int64ToInt32P(flagSet *pflag.FlagSet, name, shorthand string, value map[int64]int32, usage string) *map[int64]int32 { + p := make(map[int64]int32) + flagSet.VarP(newInt64ToInt32(value, &p), name, shorthand, usage) + return &p +} + +func newInt64ToInt64[K, V int64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt64Int64Map := newGenericMapValue(val, p) + newInt64Int64Map.Options = genericMapValueOptions[K, V]{ + genericType: "int64ToInt64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 64) + return V(value), err + }, + } + return newInt64Int64Map +} + +func Int64ToInt64P(flagSet *pflag.FlagSet, name, shorthand string, value map[int64]int64, usage string) *map[int64]int64 { + p := make(map[int64]int64) + flagSet.VarP(newInt64ToInt64(value, &p), name, shorthand, usage) + return &p +} + +func newInt64ToUint32[K int64, V uint32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt64Uint32Map := newGenericMapValue(val, p) + newInt64Uint32Map.Options = genericMapValueOptions[K, V]{ + genericType: "int64ToUint32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 32) + return V(value), err + }, + } + return newInt64Uint32Map +} + +func Int64ToUint32P(flagSet *pflag.FlagSet, name, shorthand string, value map[int64]uint32, usage string) *map[int64]uint32 { + p := make(map[int64]uint32) + flagSet.VarP(newInt64ToUint32(value, &p), name, shorthand, usage) + return &p +} + +func newInt64ToUint64[K int64, V uint64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt64Uint64Map := newGenericMapValue(val, p) + newInt64Uint64Map.Options = genericMapValueOptions[K, V]{ + genericType: "int64ToUint64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 64) + return V(value), err + }, + } + return newInt64Uint64Map +} + +func Int64ToUint64P(flagSet *pflag.FlagSet, name, shorthand string, value map[int64]uint64, usage string) *map[int64]uint64 { + p := make(map[int64]uint64) + flagSet.VarP(newInt64ToUint64(value, &p), name, shorthand, usage) + return &p +} + +func newInt64ToBool[K int64, V bool](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newInt64BoolMap := newGenericMapValue(val, p) + newInt64BoolMap.Options = genericMapValueOptions[K, V]{ + genericType: "int64ToBool", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseInt(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseBool(s) + return V(value), err + }, + } + return newInt64BoolMap +} + +func Int64ToBoolP(flagSet *pflag.FlagSet, name, shorthand string, value map[int64]bool, usage string) *map[int64]bool { + p := make(map[int64]bool) + flagSet.VarP(newInt64ToBool(value, &p), name, shorthand, usage) + return &p +} + +func newStringToUint32[K string, V uint32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newStringUintMap := newGenericMapValue(val, p) + newStringUintMap.Options = genericMapValueOptions[K, V]{ + genericType: "stringToUint32", + keyParser: func(s string) (K, error) { + return K(s), nil + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 32) + return V(value), err + }, + } + return newStringUintMap +} + +func StringToUint32P(flagSet *pflag.FlagSet, name, shorthand string, value map[string]uint32, usage string) *map[string]uint32 { + p := make(map[string]uint32) + flagSet.VarP(newStringToUint32(value, &p), name, shorthand, usage) + return &p +} + +func newStringToUint64[K string, V uint64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newStringUint64Map := newGenericMapValue(val, p) + newStringUint64Map.Options = genericMapValueOptions[K, V]{ + genericType: "stringToUint64", + keyParser: func(s string) (K, error) { + return K(s), nil + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 64) + return V(value), err + }, + } + return newStringUint64Map +} + +func StringToUint64P(flagSet *pflag.FlagSet, name, shorthand string, value map[string]uint64, usage string) *map[string]uint64 { + p := make(map[string]uint64) + flagSet.VarP(newStringToUint64(value, &p), name, shorthand, usage) + return &p +} diff --git a/client/v2/autocli/flag/map_string_to_value.go b/client/v2/autocli/flag/map_string_to_value.go new file mode 100644 index 0000000000..914835bb86 --- /dev/null +++ b/client/v2/autocli/flag/map_string_to_value.go @@ -0,0 +1,28 @@ +package flag + +import ( + "strconv" + + "github.com/spf13/pflag" +) + +func newStringToInt32[K string, V int32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newStringIntMap := newGenericMapValue(val, p) + newStringIntMap.Options = genericMapValueOptions[K, V]{ + genericType: "stringToInt32", + keyParser: func(s string) (K, error) { + return K(s), nil + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 32) + return V(value), err + }, + } + return newStringIntMap +} + +func StringToInt32P(flagSet *pflag.FlagSet, name, shorthand string, value map[string]int32, usage string) *map[string]int32 { + p := make(map[string]int32) + flagSet.VarP(newStringToInt32(value, &p), name, shorthand, usage) + return &p +} diff --git a/client/v2/autocli/flag/map_types.go b/client/v2/autocli/flag/map_types.go new file mode 100644 index 0000000000..8fc0397cbc --- /dev/null +++ b/client/v2/autocli/flag/map_types.go @@ -0,0 +1,62 @@ +package flag + +import ( + "strings" + + "github.com/cockroachdb/errors" +) + +type genericMapValueOptions[K comparable, V any] struct { + keyParser func(string) (K, error) + valueParser func(string) (V, error) + genericType string +} + +type genericMapValue[K comparable, V any] struct { + value *map[K]V + changed bool + Options genericMapValueOptions[K, V] +} + +func newGenericMapValue[K comparable, V any](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + ssv := new(genericMapValue[K, V]) + ssv.value = p + *ssv.value = val + return ssv +} + +func (gm *genericMapValue[K, V]) Set(val string) error { + ss := strings.Split(val, ",") + out := make(map[K]V, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return errors.Errorf("%s must be formatted as key=value", pair) + } + key, err := gm.Options.keyParser(kv[0]) + if err != nil { + return err + } + out[key], err = gm.Options.valueParser(kv[1]) + if err != nil { + return err + } + } + if !gm.changed { + *gm.value = out + } else { + for k, v := range out { + (*gm.value)[k] = v + } + } + gm.changed = true + return nil +} + +func (gm *genericMapValue[K, V]) Type() string { + return gm.Options.genericType +} + +func (gm *genericMapValue[K, V]) String() string { + return "" +} diff --git a/client/v2/autocli/flag/map_uint32_to_value.go b/client/v2/autocli/flag/map_uint32_to_value.go new file mode 100644 index 0000000000..ae5edc5ab4 --- /dev/null +++ b/client/v2/autocli/flag/map_uint32_to_value.go @@ -0,0 +1,138 @@ +package flag + +import ( + "strconv" + + "github.com/spf13/pflag" +) + +func newUint32ToString[K uint32, V string](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint32StringMap := newGenericMapValue(val, p) + newUint32StringMap.Options = genericMapValueOptions[K, V]{ + genericType: "uint32ToString", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + return V(s), nil + }, + } + return newUint32StringMap +} + +func Uint32ToStringP(flagSet *pflag.FlagSet, name, shorthand string, value map[uint32]string, usage string) *map[uint32]string { + p := make(map[uint32]string) + flagSet.VarP(newUint32ToString(value, &p), name, shorthand, usage) + return &p +} + +func newUint32ToInt32[K uint32, V int32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint32Int32Map := newGenericMapValue(val, p) + newUint32Int32Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint32ToInt32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 32) + return V(value), err + }, + } + return newUint32Int32Map +} + +func Uint32ToInt32P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint32]int32, usage string) *map[uint32]int32 { + p := make(map[uint32]int32) + flagSet.VarP(newUint32ToInt32(value, &p), name, shorthand, usage) + return &p +} + +func newUint32ToInt64[K uint32, V int64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint32Int64Map := newGenericMapValue(val, p) + newUint32Int64Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint32ToInt64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 64) + return V(value), err + }, + } + return newUint32Int64Map +} + +func Uint32ToInt64P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint32]int64, usage string) *map[uint32]int64 { + p := make(map[uint32]int64) + flagSet.VarP(newUint32ToInt64(value, &p), name, shorthand, usage) + return &p +} + +func newUint32ToUint32[K, V uint32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint32Uint32Map := newGenericMapValue(val, p) + newUint32Uint32Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint32ToUint32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 32) + return V(value), err + }, + } + return newUint32Uint32Map +} + +func Uint32ToUint32P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint32]uint32, usage string) *map[uint32]uint32 { + p := make(map[uint32]uint32) + flagSet.VarP(newUint32ToUint32(value, &p), name, shorthand, usage) + return &p +} + +func newUint32ToUint64[K uint32, V uint64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint32Uint64Map := newGenericMapValue(val, p) + newUint32Uint64Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint32ToUint64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 64) + return V(value), err + }, + } + return newUint32Uint64Map +} + +func Uint32ToUint64P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint32]uint64, usage string) *map[uint32]uint64 { + p := make(map[uint32]uint64) + flagSet.VarP(newUint32ToUint64(value, &p), name, shorthand, usage) + return &p +} + +func newUint32ToBool[K uint32, V bool](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint32BoolMap := newGenericMapValue(val, p) + newUint32BoolMap.Options = genericMapValueOptions[K, V]{ + genericType: "uint32ToBool", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 32) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseBool(s) + return V(value), err + }, + } + return newUint32BoolMap +} + +func Uint32ToBoolP(flagSet *pflag.FlagSet, name, shorthand string, value map[uint32]bool, usage string) *map[uint32]bool { + p := make(map[uint32]bool) + flagSet.VarP(newUint32ToBool(value, &p), name, shorthand, usage) + return &p +} diff --git a/client/v2/autocli/flag/map_uint64_to_value.go b/client/v2/autocli/flag/map_uint64_to_value.go new file mode 100644 index 0000000000..a53be1864c --- /dev/null +++ b/client/v2/autocli/flag/map_uint64_to_value.go @@ -0,0 +1,138 @@ +package flag + +import ( + "strconv" + + "github.com/spf13/pflag" +) + +func newUint64ToString[K uint64, V string](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint64StringMap := newGenericMapValue(val, p) + newUint64StringMap.Options = genericMapValueOptions[K, V]{ + genericType: "uint64ToString", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + return V(s), nil + }, + } + return newUint64StringMap +} + +func Uint64ToStringP(flagSet *pflag.FlagSet, name, shorthand string, value map[uint64]string, usage string) *map[uint64]string { + p := make(map[uint64]string) + flagSet.VarP(newUint64ToString(value, &p), name, shorthand, usage) + return &p +} + +func newUint64ToInt32[K uint64, V int32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint64Int32Map := newGenericMapValue(val, p) + newUint64Int32Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint64ToInt32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 32) + return V(value), err + }, + } + return newUint64Int32Map +} + +func Uint64ToInt32P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint64]int32, usage string) *map[uint64]int32 { + p := make(map[uint64]int32) + flagSet.VarP(newUint64ToInt32(value, &p), name, shorthand, usage) + return &p +} + +func newUint64ToInt64[K uint64, V int64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint64Int64Map := newGenericMapValue(val, p) + newUint64Int64Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint64ToInt64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseInt(s, 10, 64) + return V(value), err + }, + } + return newUint64Int64Map +} + +func Uint64ToInt64P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint64]int64, usage string) *map[uint64]int64 { + p := make(map[uint64]int64) + flagSet.VarP(newUint64ToInt64(value, &p), name, shorthand, usage) + return &p +} + +func newUint64ToUint32[K uint64, V uint32](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint64Uint32Map := newGenericMapValue(val, p) + newUint64Uint32Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint64ToUint32", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 32) + return V(value), err + }, + } + return newUint64Uint32Map +} + +func Uint64ToUint32P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint64]uint32, usage string) *map[uint64]uint32 { + p := make(map[uint64]uint32) + flagSet.VarP(newUint64ToUint32(value, &p), name, shorthand, usage) + return &p +} + +func newUint64ToUint64[K, V uint64](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint64Uint64Map := newGenericMapValue(val, p) + newUint64Uint64Map.Options = genericMapValueOptions[K, V]{ + genericType: "uint64ToUint64", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseUint(s, 10, 64) + return V(value), err + }, + } + return newUint64Uint64Map +} + +func Uint64ToUint64P(flagSet *pflag.FlagSet, name, shorthand string, value map[uint64]uint64, usage string) *map[uint64]uint64 { + p := make(map[uint64]uint64) + flagSet.VarP(newUint64ToUint64(value, &p), name, shorthand, usage) + return &p +} + +func newUint64ToBool[K uint64, V bool](val map[K]V, p *map[K]V) *genericMapValue[K, V] { + newUint64BoolMap := newGenericMapValue(val, p) + newUint64BoolMap.Options = genericMapValueOptions[K, V]{ + genericType: "uint64ToBool", + keyParser: func(s string) (K, error) { + value, err := strconv.ParseUint(s, 10, 64) + return K(value), err + }, + valueParser: func(s string) (V, error) { + value, err := strconv.ParseBool(s) + return V(value), err + }, + } + return newUint64BoolMap +} + +func Uint64ToBoolP(flagSet *pflag.FlagSet, name, shorthand string, value map[uint64]bool, usage string) *map[uint64]bool { + p := make(map[uint64]bool) + flagSet.VarP(newUint64ToBool(value, &p), name, shorthand, usage) + return &p +} diff --git a/client/v2/autocli/query_test.go b/client/v2/autocli/query_test.go index 67b0293131..635060b3f9 100644 --- a/client/v2/autocli/query_test.go +++ b/client/v2/autocli/query_test.go @@ -82,6 +82,15 @@ var testCmdDesc = &autocliv1.ServiceCommandDescriptor{ "bz": { Usage: "some bytes", }, + "map_string_string": { + Usage: "some map of string to string", + }, + "map_string_uint32": { + Usage: "some map of string to int32", + }, + "map_string_coin": { + Usage: "some map of string to coin", + }, }, }, }, @@ -121,6 +130,72 @@ func TestCoin(t *testing.T) { assert.DeepEqual(t, conn.lastRequest, conn.lastResponse.(*testpb.EchoResponse).Request, protocmp.Transform()) } +func TestMap(t *testing.T) { + conn := testExecCommon(t, buildModuleQueryCommand, + "echo", + "1", + "abc", + "1234foo", + "4321bar", + "--map-string-uint32", "bar=123", + "--map-string-string", "val=foo", + "--map-string-coin", "baz=100000foo", + "--map-string-coin", "sec=100000bar", + "--map-string-coin", "multi=100000bar,flag=100000foo", + ) + assert.DeepEqual(t, conn.lastRequest, conn.lastResponse.(*testpb.EchoResponse).Request, protocmp.Transform()) + + conn = testExecCommon(t, buildModuleQueryCommand, + "echo", + "1", + "abc", + "1234foo", + "4321bar", + "--map-string-uint32", "bar=123", + "--map-string-coin", "baz,100000foo", + "--map-string-coin", "sec=100000bar", + ) + assert.Equal(t, "Error: invalid argument \"baz,100000foo\" for \"--map-string-coin\" flag: invalid format, expected key=value\n", conn.errorOut.String()) + + conn = testExecCommon(t, buildModuleQueryCommand, + "echo", + "1", + "abc", + "1234foo", + "4321bar", + "--map-string-uint32", "bar=not-unint32", + "--map-string-coin", "baz=100000foo", + "--map-string-coin", "sec=100000bar", + ) + assert.Equal(t, "Error: invalid argument \"bar=not-unint32\" for \"--map-string-uint32\" flag: strconv.ParseUint: parsing \"not-unint32\": invalid syntax\n", conn.errorOut.String()) + + conn = testExecCommon(t, buildModuleQueryCommand, + "echo", + "1", + "abc", + "1234foo", + "4321bar", + "--map-string-uint32", "bar=123.9", + "--map-string-coin", "baz=100000foo", + "--map-string-coin", "sec=100000bar", + ) + assert.Equal(t, "Error: invalid argument \"bar=123.9\" for \"--map-string-uint32\" flag: strconv.ParseUint: parsing \"123.9\": invalid syntax\n", conn.errorOut.String()) +} + +func TestMapError(t *testing.T) { + conn := testExecCommon(t, buildModuleQueryCommand, + "echo", + "1", + "abc", + "1234foo", + "4321bar", + "--map-string-uint32", "bar=123", + "--map-string-coin", "baz=100000foo", + "--map-string-coin", "sec=100000bar", + ) + assert.DeepEqual(t, conn.lastRequest, conn.lastResponse.(*testpb.EchoResponse).Request, protocmp.Transform()) +} + func TestEverything(t *testing.T) { conn := testExecCommon(t, buildModuleQueryCommand, "echo", @@ -163,9 +238,6 @@ func TestEverything(t *testing.T) { "--uints", "1,2,3", "--uints", "4", ) - errOut := conn.errorOut.String() - res := conn.out.String() - fmt.Println(errOut, res) assert.DeepEqual(t, conn.lastRequest, conn.lastResponse.(*testpb.EchoResponse).Request, protocmp.Transform()) } diff --git a/client/v2/autocli/testdata/help-deprecated.golden b/client/v2/autocli/testdata/help-deprecated.golden index 963da0986b..c958a689f8 100644 --- a/client/v2/autocli/testdata/help-deprecated.golden +++ b/client/v2/autocli/testdata/help-deprecated.golden @@ -21,6 +21,9 @@ Flags: --hidden-bool --i32 int32 --i64 int + --map-string-coin map[string]cosmos.base.v1beta1.Coin + --map-string-string stringToString (default []) + --map-string-uint32 stringToUint32 --node string : to CometBFT RPC interface for this chain (default "tcp://localhost:26657") -o, --output string Output format (text|json) (default "text") --page-count-total diff --git a/client/v2/autocli/testdata/help-echo.golden b/client/v2/autocli/testdata/help-echo.golden index 9e5f52f6da..0be9c1de58 100644 --- a/client/v2/autocli/testdata/help-echo.golden +++ b/client/v2/autocli/testdata/help-echo.golden @@ -27,6 +27,9 @@ Flags: -h, --help help for echo --i32 int32 some random int32 --i64 int + --map-string-coin map[string]cosmos.base.v1beta1.Coin some map of string to coin + --map-string-string stringToString some map of string to string (default []) + --map-string-uint32 stringToUint32 some map of string to int32 --node string : to CometBFT RPC interface for this chain (default "tcp://localhost:26657") -o, --output string Output format (text|json) (default "text") --page-count-total diff --git a/client/v2/internal/testpb/query.proto b/client/v2/internal/testpb/query.proto index baef01c148..5e2a5171e4 100644 --- a/client/v2/internal/testpb/query.proto +++ b/client/v2/internal/testpb/query.proto @@ -43,6 +43,9 @@ message EchoRequest { string deprecated_field = 30; string shorthand_deprecated_field = 31; bool hidden_bool = 32; + map map_string_string = 33; + map map_string_uint32 = 34; + map map_string_coin = 35; } enum Enum { diff --git a/client/v2/internal/testpb/query.pulsar.go b/client/v2/internal/testpb/query.pulsar.go index e8743333c3..7baf83be9f 100644 --- a/client/v2/internal/testpb/query.pulsar.go +++ b/client/v2/internal/testpb/query.pulsar.go @@ -14,6 +14,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" io "io" reflect "reflect" + sort "sort" sync "sync" ) @@ -354,6 +355,260 @@ func (x *_EchoRequest_29_list) IsValid() bool { return x.list != nil } +var _ protoreflect.Map = (*_EchoRequest_33_map)(nil) + +type _EchoRequest_33_map struct { + m *map[string]string +} + +func (x *_EchoRequest_33_map) Len() int { + if x.m == nil { + return 0 + } + return len(*x.m) +} + +func (x *_EchoRequest_33_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { + if x.m == nil { + return + } + for k, v := range *x.m { + mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) + mapValue := protoreflect.ValueOfString(v) + if !f(mapKey, mapValue) { + break + } + } +} + +func (x *_EchoRequest_33_map) Has(key protoreflect.MapKey) bool { + if x.m == nil { + return false + } + keyUnwrapped := key.String() + concreteValue := keyUnwrapped + _, ok := (*x.m)[concreteValue] + return ok +} + +func (x *_EchoRequest_33_map) Clear(key protoreflect.MapKey) { + if x.m == nil { + return + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + delete(*x.m, concreteKey) +} + +func (x *_EchoRequest_33_map) Get(key protoreflect.MapKey) protoreflect.Value { + if x.m == nil { + return protoreflect.Value{} + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if !ok { + return protoreflect.Value{} + } + return protoreflect.ValueOfString(v) +} + +func (x *_EchoRequest_33_map) Set(key protoreflect.MapKey, value protoreflect.Value) { + if !key.IsValid() || !value.IsValid() { + panic("invalid key or value provided") + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.m)[concreteKey] = concreteValue +} + +func (x *_EchoRequest_33_map) Mutable(key protoreflect.MapKey) protoreflect.Value { + panic("should not call Mutable on protoreflect.Map whose value is not of type protoreflect.Message") +} + +func (x *_EchoRequest_33_map) NewValue() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_EchoRequest_33_map) IsValid() bool { + return x.m != nil +} + +var _ protoreflect.Map = (*_EchoRequest_34_map)(nil) + +type _EchoRequest_34_map struct { + m *map[string]uint32 +} + +func (x *_EchoRequest_34_map) Len() int { + if x.m == nil { + return 0 + } + return len(*x.m) +} + +func (x *_EchoRequest_34_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { + if x.m == nil { + return + } + for k, v := range *x.m { + mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) + mapValue := protoreflect.ValueOfUint32(v) + if !f(mapKey, mapValue) { + break + } + } +} + +func (x *_EchoRequest_34_map) Has(key protoreflect.MapKey) bool { + if x.m == nil { + return false + } + keyUnwrapped := key.String() + concreteValue := keyUnwrapped + _, ok := (*x.m)[concreteValue] + return ok +} + +func (x *_EchoRequest_34_map) Clear(key protoreflect.MapKey) { + if x.m == nil { + return + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + delete(*x.m, concreteKey) +} + +func (x *_EchoRequest_34_map) Get(key protoreflect.MapKey) protoreflect.Value { + if x.m == nil { + return protoreflect.Value{} + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if !ok { + return protoreflect.Value{} + } + return protoreflect.ValueOfUint32(v) +} + +func (x *_EchoRequest_34_map) Set(key protoreflect.MapKey, value protoreflect.Value) { + if !key.IsValid() || !value.IsValid() { + panic("invalid key or value provided") + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + valueUnwrapped := value.Uint() + concreteValue := (uint32)(valueUnwrapped) + (*x.m)[concreteKey] = concreteValue +} + +func (x *_EchoRequest_34_map) Mutable(key protoreflect.MapKey) protoreflect.Value { + panic("should not call Mutable on protoreflect.Map whose value is not of type protoreflect.Message") +} + +func (x *_EchoRequest_34_map) NewValue() protoreflect.Value { + v := uint32(0) + return protoreflect.ValueOfUint32(v) +} + +func (x *_EchoRequest_34_map) IsValid() bool { + return x.m != nil +} + +var _ protoreflect.Map = (*_EchoRequest_35_map)(nil) + +type _EchoRequest_35_map struct { + m *map[string]*v1beta1.Coin +} + +func (x *_EchoRequest_35_map) Len() int { + if x.m == nil { + return 0 + } + return len(*x.m) +} + +func (x *_EchoRequest_35_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { + if x.m == nil { + return + } + for k, v := range *x.m { + mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) + mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(mapKey, mapValue) { + break + } + } +} + +func (x *_EchoRequest_35_map) Has(key protoreflect.MapKey) bool { + if x.m == nil { + return false + } + keyUnwrapped := key.String() + concreteValue := keyUnwrapped + _, ok := (*x.m)[concreteValue] + return ok +} + +func (x *_EchoRequest_35_map) Clear(key protoreflect.MapKey) { + if x.m == nil { + return + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + delete(*x.m, concreteKey) +} + +func (x *_EchoRequest_35_map) Get(key protoreflect.MapKey) protoreflect.Value { + if x.m == nil { + return protoreflect.Value{} + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if !ok { + return protoreflect.Value{} + } + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EchoRequest_35_map) Set(key protoreflect.MapKey, value protoreflect.Value) { + if !key.IsValid() || !value.IsValid() { + panic("invalid key or value provided") + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*v1beta1.Coin) + (*x.m)[concreteKey] = concreteValue +} + +func (x *_EchoRequest_35_map) Mutable(key protoreflect.MapKey) protoreflect.Value { + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if ok { + return protoreflect.ValueOfMessage(v.ProtoReflect()) + } + newValue := new(v1beta1.Coin) + (*x.m)[concreteKey] = newValue + return protoreflect.ValueOfMessage(newValue.ProtoReflect()) +} + +func (x *_EchoRequest_35_map) NewValue() protoreflect.Value { + v := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_EchoRequest_35_map) IsValid() bool { + return x.m != nil +} + var ( md_EchoRequest protoreflect.MessageDescriptor fd_EchoRequest_u32 protoreflect.FieldDescriptor @@ -382,6 +637,9 @@ var ( fd_EchoRequest_deprecated_field protoreflect.FieldDescriptor fd_EchoRequest_shorthand_deprecated_field protoreflect.FieldDescriptor fd_EchoRequest_hidden_bool protoreflect.FieldDescriptor + fd_EchoRequest_map_string_string protoreflect.FieldDescriptor + fd_EchoRequest_map_string_uint32 protoreflect.FieldDescriptor + fd_EchoRequest_map_string_coin protoreflect.FieldDescriptor ) func init() { @@ -413,6 +671,9 @@ func init() { fd_EchoRequest_deprecated_field = md_EchoRequest.Fields().ByName("deprecated_field") fd_EchoRequest_shorthand_deprecated_field = md_EchoRequest.Fields().ByName("shorthand_deprecated_field") fd_EchoRequest_hidden_bool = md_EchoRequest.Fields().ByName("hidden_bool") + fd_EchoRequest_map_string_string = md_EchoRequest.Fields().ByName("map_string_string") + fd_EchoRequest_map_string_uint32 = md_EchoRequest.Fields().ByName("map_string_uint32") + fd_EchoRequest_map_string_coin = md_EchoRequest.Fields().ByName("map_string_coin") } var _ protoreflect.Message = (*fastReflection_EchoRequest)(nil) @@ -636,6 +897,24 @@ func (x *fastReflection_EchoRequest) Range(f func(protoreflect.FieldDescriptor, return } } + if len(x.MapStringString) != 0 { + value := protoreflect.ValueOfMap(&_EchoRequest_33_map{m: &x.MapStringString}) + if !f(fd_EchoRequest_map_string_string, value) { + return + } + } + if len(x.MapStringUint32) != 0 { + value := protoreflect.ValueOfMap(&_EchoRequest_34_map{m: &x.MapStringUint32}) + if !f(fd_EchoRequest_map_string_uint32, value) { + return + } + } + if len(x.MapStringCoin) != 0 { + value := protoreflect.ValueOfMap(&_EchoRequest_35_map{m: &x.MapStringCoin}) + if !f(fd_EchoRequest_map_string_coin, value) { + return + } + } } // Has reports whether a field is populated. @@ -703,6 +982,12 @@ func (x *fastReflection_EchoRequest) Has(fd protoreflect.FieldDescriptor) bool { return x.ShorthandDeprecatedField != "" case "testpb.EchoRequest.hidden_bool": return x.HiddenBool != false + case "testpb.EchoRequest.map_string_string": + return len(x.MapStringString) != 0 + case "testpb.EchoRequest.map_string_uint32": + return len(x.MapStringUint32) != 0 + case "testpb.EchoRequest.map_string_coin": + return len(x.MapStringCoin) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) @@ -771,6 +1056,12 @@ func (x *fastReflection_EchoRequest) Clear(fd protoreflect.FieldDescriptor) { x.ShorthandDeprecatedField = "" case "testpb.EchoRequest.hidden_bool": x.HiddenBool = false + case "testpb.EchoRequest.map_string_string": + x.MapStringString = nil + case "testpb.EchoRequest.map_string_uint32": + x.MapStringUint32 = nil + case "testpb.EchoRequest.map_string_coin": + x.MapStringCoin = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) @@ -886,6 +1177,24 @@ func (x *fastReflection_EchoRequest) Get(descriptor protoreflect.FieldDescriptor case "testpb.EchoRequest.hidden_bool": value := x.HiddenBool return protoreflect.ValueOfBool(value) + case "testpb.EchoRequest.map_string_string": + if len(x.MapStringString) == 0 { + return protoreflect.ValueOfMap(&_EchoRequest_33_map{}) + } + mapValue := &_EchoRequest_33_map{m: &x.MapStringString} + return protoreflect.ValueOfMap(mapValue) + case "testpb.EchoRequest.map_string_uint32": + if len(x.MapStringUint32) == 0 { + return protoreflect.ValueOfMap(&_EchoRequest_34_map{}) + } + mapValue := &_EchoRequest_34_map{m: &x.MapStringUint32} + return protoreflect.ValueOfMap(mapValue) + case "testpb.EchoRequest.map_string_coin": + if len(x.MapStringCoin) == 0 { + return protoreflect.ValueOfMap(&_EchoRequest_35_map{}) + } + mapValue := &_EchoRequest_35_map{m: &x.MapStringCoin} + return protoreflect.ValueOfMap(mapValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) @@ -972,6 +1281,18 @@ func (x *fastReflection_EchoRequest) Set(fd protoreflect.FieldDescriptor, value x.ShorthandDeprecatedField = value.Interface().(string) case "testpb.EchoRequest.hidden_bool": x.HiddenBool = value.Bool() + case "testpb.EchoRequest.map_string_string": + mv := value.Map() + cmv := mv.(*_EchoRequest_33_map) + x.MapStringString = *cmv.m + case "testpb.EchoRequest.map_string_uint32": + mv := value.Map() + cmv := mv.(*_EchoRequest_34_map) + x.MapStringUint32 = *cmv.m + case "testpb.EchoRequest.map_string_coin": + mv := value.Map() + cmv := mv.(*_EchoRequest_35_map) + x.MapStringCoin = *cmv.m default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) @@ -1059,6 +1380,24 @@ func (x *fastReflection_EchoRequest) Mutable(fd protoreflect.FieldDescriptor) pr } value := &_EchoRequest_29_list{list: &x.Positional3Varargs} return protoreflect.ValueOfList(value) + case "testpb.EchoRequest.map_string_string": + if x.MapStringString == nil { + x.MapStringString = make(map[string]string) + } + value := &_EchoRequest_33_map{m: &x.MapStringString} + return protoreflect.ValueOfMap(value) + case "testpb.EchoRequest.map_string_uint32": + if x.MapStringUint32 == nil { + x.MapStringUint32 = make(map[string]uint32) + } + value := &_EchoRequest_34_map{m: &x.MapStringUint32} + return protoreflect.ValueOfMap(value) + case "testpb.EchoRequest.map_string_coin": + if x.MapStringCoin == nil { + x.MapStringCoin = make(map[string]*v1beta1.Coin) + } + value := &_EchoRequest_35_map{m: &x.MapStringCoin} + return protoreflect.ValueOfMap(value) case "testpb.EchoRequest.u32": panic(fmt.Errorf("field u32 of message testpb.EchoRequest is not mutable")) case "testpb.EchoRequest.u64": @@ -1164,6 +1503,15 @@ func (x *fastReflection_EchoRequest) NewField(fd protoreflect.FieldDescriptor) p return protoreflect.ValueOfString("") case "testpb.EchoRequest.hidden_bool": return protoreflect.ValueOfBool(false) + case "testpb.EchoRequest.map_string_string": + m := make(map[string]string) + return protoreflect.ValueOfMap(&_EchoRequest_33_map{m: &m}) + case "testpb.EchoRequest.map_string_uint32": + m := make(map[string]uint32) + return protoreflect.ValueOfMap(&_EchoRequest_34_map{m: &m}) + case "testpb.EchoRequest.map_string_coin": + m := make(map[string]*v1beta1.Coin) + return protoreflect.ValueOfMap(&_EchoRequest_35_map{m: &m}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: testpb.EchoRequest")) @@ -1342,6 +1690,74 @@ func (x *fastReflection_EchoRequest) ProtoMethods() *protoiface.Methods { if x.HiddenBool { n += 3 } + if len(x.MapStringString) > 0 { + SiZeMaP := func(k string, v string) { + mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + 1 + len(v) + runtime.Sov(uint64(len(v))) + n += mapEntrySize + 2 + runtime.Sov(uint64(mapEntrySize)) + } + if options.Deterministic { + sortme := make([]string, 0, len(x.MapStringString)) + for k := range x.MapStringString { + sortme = append(sortme, k) + } + sort.Strings(sortme) + for _, k := range sortme { + v := x.MapStringString[k] + SiZeMaP(k, v) + } + } else { + for k, v := range x.MapStringString { + SiZeMaP(k, v) + } + } + } + if len(x.MapStringUint32) > 0 { + SiZeMaP := func(k string, v uint32) { + mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + 1 + runtime.Sov(uint64(v)) + n += mapEntrySize + 2 + runtime.Sov(uint64(mapEntrySize)) + } + if options.Deterministic { + sortme := make([]string, 0, len(x.MapStringUint32)) + for k := range x.MapStringUint32 { + sortme = append(sortme, k) + } + sort.Strings(sortme) + for _, k := range sortme { + v := x.MapStringUint32[k] + SiZeMaP(k, v) + } + } else { + for k, v := range x.MapStringUint32 { + SiZeMaP(k, v) + } + } + } + if len(x.MapStringCoin) > 0 { + SiZeMaP := func(k string, v *v1beta1.Coin) { + l := 0 + if v != nil { + l = options.Size(v) + } + l += 1 + runtime.Sov(uint64(l)) + mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l + n += mapEntrySize + 2 + runtime.Sov(uint64(mapEntrySize)) + } + if options.Deterministic { + sortme := make([]string, 0, len(x.MapStringCoin)) + for k := range x.MapStringCoin { + sortme = append(sortme, k) + } + sort.Strings(sortme) + for _, k := range sortme { + v := x.MapStringCoin[k] + SiZeMaP(k, v) + } + } else { + for k, v := range x.MapStringCoin { + SiZeMaP(k, v) + } + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1371,6 +1787,146 @@ func (x *fastReflection_EchoRequest) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.MapStringCoin) > 0 { + MaRsHaLmAp := func(k string, v *v1beta1.Coin) (protoiface.MarshalOutput, error) { + baseI := i + encoded, err := options.Marshal(v) + 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] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0x9a + return protoiface.MarshalOutput{}, nil + } + if options.Deterministic { + keysForMapStringCoin := make([]string, 0, len(x.MapStringCoin)) + for k := range x.MapStringCoin { + keysForMapStringCoin = append(keysForMapStringCoin, string(k)) + } + sort.Slice(keysForMapStringCoin, func(i, j int) bool { + return keysForMapStringCoin[i] < keysForMapStringCoin[j] + }) + for iNdEx := len(keysForMapStringCoin) - 1; iNdEx >= 0; iNdEx-- { + v := x.MapStringCoin[string(keysForMapStringCoin[iNdEx])] + out, err := MaRsHaLmAp(keysForMapStringCoin[iNdEx], v) + if err != nil { + return out, err + } + } + } else { + for k := range x.MapStringCoin { + v := x.MapStringCoin[k] + out, err := MaRsHaLmAp(k, v) + if err != nil { + return out, err + } + } + } + } + if len(x.MapStringUint32) > 0 { + MaRsHaLmAp := func(k string, v uint32) (protoiface.MarshalOutput, error) { + baseI := i + i = runtime.EncodeVarint(dAtA, i, uint64(v)) + i-- + dAtA[i] = 0x10 + i -= len(k) + copy(dAtA[i:], k) + i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0x92 + return protoiface.MarshalOutput{}, nil + } + if options.Deterministic { + keysForMapStringUint32 := make([]string, 0, len(x.MapStringUint32)) + for k := range x.MapStringUint32 { + keysForMapStringUint32 = append(keysForMapStringUint32, string(k)) + } + sort.Slice(keysForMapStringUint32, func(i, j int) bool { + return keysForMapStringUint32[i] < keysForMapStringUint32[j] + }) + for iNdEx := len(keysForMapStringUint32) - 1; iNdEx >= 0; iNdEx-- { + v := x.MapStringUint32[string(keysForMapStringUint32[iNdEx])] + out, err := MaRsHaLmAp(keysForMapStringUint32[iNdEx], v) + if err != nil { + return out, err + } + } + } else { + for k := range x.MapStringUint32 { + v := x.MapStringUint32[k] + out, err := MaRsHaLmAp(k, v) + if err != nil { + return out, err + } + } + } + } + if len(x.MapStringString) > 0 { + MaRsHaLmAp := func(k string, v string) (protoiface.MarshalOutput, error) { + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = runtime.EncodeVarint(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2 + i-- + dAtA[i] = 0x8a + return protoiface.MarshalOutput{}, nil + } + if options.Deterministic { + keysForMapStringString := make([]string, 0, len(x.MapStringString)) + for k := range x.MapStringString { + keysForMapStringString = append(keysForMapStringString, string(k)) + } + sort.Slice(keysForMapStringString, func(i, j int) bool { + return keysForMapStringString[i] < keysForMapStringString[j] + }) + for iNdEx := len(keysForMapStringString) - 1; iNdEx >= 0; iNdEx-- { + v := x.MapStringString[string(keysForMapStringString[iNdEx])] + out, err := MaRsHaLmAp(keysForMapStringString[iNdEx], v) + if err != nil { + return out, err + } + } + } else { + for k := range x.MapStringString { + v := x.MapStringString[k] + out, err := MaRsHaLmAp(k, v) + if err != nil { + return out, err + } + } + } + } if x.HiddenBool { i-- if x.HiddenBool { @@ -2604,6 +3160,375 @@ func (x *fastReflection_EchoRequest) ProtoMethods() *protoiface.Methods { } } x.HiddenBool = bool(v != 0) + case 33: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MapStringString", 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.MapStringString == nil { + x.MapStringString = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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) + if fieldNum == 1 { + var stringLenmapkey 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++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postStringIndexmapkey > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postStringIndexmapvalue > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + 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) > postIndex { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + x.MapStringString[mapkey] = mapvalue + iNdEx = postIndex + case 34: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MapStringUint32", 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.MapStringUint32 == nil { + x.MapStringUint32 = make(map[string]uint32) + } + var mapkey string + var mapvalue uint32 + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey 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++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postStringIndexmapkey > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + 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++ + mapvalue |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else { + iNdEx = entryPreIndex + 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) > postIndex { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + x.MapStringUint32[mapkey] = mapvalue + iNdEx = postIndex + case 35: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MapStringCoin", 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.MapStringCoin == nil { + x.MapStringCoin = make(map[string]*v1beta1.Coin) + } + var mapkey string + var mapvalue *v1beta1.Coin + for iNdEx < postIndex { + entryPreIndex := 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) + if fieldNum == 1 { + var stringLenmapkey 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++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postStringIndexmapkey > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen 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++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postmsgIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + mapvalue = &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + 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) > postIndex { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + x.MapStringCoin[mapkey] = mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3616,32 +4541,35 @@ type EchoRequest struct { 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"` - Positional1 int32 `protobuf:"varint,27,opt,name=positional1,proto3" json:"positional1,omitempty"` - Positional2 string `protobuf:"bytes,28,opt,name=positional2,proto3" json:"positional2,omitempty"` - Positional3Varargs []*v1beta1.Coin `protobuf:"bytes,29,rep,name=positional3_varargs,json=positional3Varargs,proto3" json:"positional3_varargs,omitempty"` - DeprecatedField string `protobuf:"bytes,30,opt,name=deprecated_field,json=deprecatedField,proto3" json:"deprecated_field,omitempty"` - ShorthandDeprecatedField string `protobuf:"bytes,31,opt,name=shorthand_deprecated_field,json=shorthandDeprecatedField,proto3" json:"shorthand_deprecated_field,omitempty"` - HiddenBool bool `protobuf:"varint,32,opt,name=hidden_bool,json=hiddenBool,proto3" json:"hidden_bool,omitempty"` + 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"` + Positional1 int32 `protobuf:"varint,27,opt,name=positional1,proto3" json:"positional1,omitempty"` + Positional2 string `protobuf:"bytes,28,opt,name=positional2,proto3" json:"positional2,omitempty"` + Positional3Varargs []*v1beta1.Coin `protobuf:"bytes,29,rep,name=positional3_varargs,json=positional3Varargs,proto3" json:"positional3_varargs,omitempty"` + DeprecatedField string `protobuf:"bytes,30,opt,name=deprecated_field,json=deprecatedField,proto3" json:"deprecated_field,omitempty"` + ShorthandDeprecatedField string `protobuf:"bytes,31,opt,name=shorthand_deprecated_field,json=shorthandDeprecatedField,proto3" json:"shorthand_deprecated_field,omitempty"` + HiddenBool bool `protobuf:"varint,32,opt,name=hidden_bool,json=hiddenBool,proto3" json:"hidden_bool,omitempty"` + MapStringString map[string]string `protobuf:"bytes,33,rep,name=map_string_string,json=mapStringString,proto3" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + MapStringUint32 map[string]uint32 `protobuf:"bytes,34,rep,name=map_string_uint32,json=mapStringUint32,proto3" json:"map_string_uint32,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + MapStringCoin map[string]*v1beta1.Coin `protobuf:"bytes,35,rep,name=map_string_coin,json=mapStringCoin,proto3" json:"map_string_coin,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *EchoRequest) Reset() { @@ -3846,6 +4774,27 @@ func (x *EchoRequest) GetHiddenBool() bool { return false } +func (x *EchoRequest) GetMapStringString() map[string]string { + if x != nil { + return x.MapStringString + } + return nil +} + +func (x *EchoRequest) GetMapStringUint32() map[string]uint32 { + if x != nil { + return x.MapStringUint32 + } + return nil +} + +func (x *EchoRequest) GetMapStringCoin() map[string]*v1beta1.Coin { + if x != nil { + return x.MapStringCoin + } + return nil +} + type AMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3939,7 +4888,7 @@ var file_testpb_query_proto_rawDesc = []byte{ 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, 0xf0, 0x07, 0x0a, 0x0b, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd1, 0x0b, 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, @@ -4002,33 +4951,63 @@ var file_testpb_query_proto_rawDesc = []byte{ 0x6f, 0x72, 0x74, 0x68, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x20, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x68, 0x69, 0x64, - 0x64, 0x65, 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 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, + 0x64, 0x65, 0x6e, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x54, 0x0a, 0x11, 0x6d, 0x61, 0x70, 0x5f, 0x73, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x21, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x45, 0x63, 0x68, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x6d, 0x61, + 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x54, 0x0a, + 0x11, 0x6d, 0x61, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x75, 0x69, 0x6e, 0x74, + 0x33, 0x32, 0x18, 0x22, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x70, + 0x62, 0x2e, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x61, + 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x0f, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x55, 0x69, 0x6e, + 0x74, 0x33, 0x32, 0x12, 0x4e, 0x0a, 0x0f, 0x6d, 0x61, 0x70, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x23, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x74, + 0x65, 0x73, 0x74, 0x70, 0x62, 0x2e, 0x45, 0x63, 0x68, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x69, 0x6e, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, + 0x6f, 0x69, 0x6e, 0x1a, 0x42, 0x0a, 0x14, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x42, 0x0a, 0x14, 0x4d, 0x61, 0x70, 0x53, 0x74, + 0x72, 0x69, 0x6e, 0x67, 0x55, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5b, 0x0a, 0x12, 0x4d, + 0x61, 0x70, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 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, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 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 ( @@ -4044,36 +5023,43 @@ func file_testpb_query_proto_rawDescGZIP() []byte { } 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_msgTypes = make([]protoimpl.MessageInfo, 6) 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 + nil, // 4: testpb.EchoRequest.MapStringStringEntry + nil, // 5: testpb.EchoRequest.MapStringUint32Entry + nil, // 6: testpb.EchoRequest.MapStringCoinEntry + (*timestamppb.Timestamp)(nil), // 7: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 8: google.protobuf.Duration + (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin + (*v1beta11.PageRequest)(nil), // 10: 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 + 7, // 0: testpb.EchoRequest.timestamp:type_name -> google.protobuf.Timestamp + 8, // 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 + 9, // 4: testpb.EchoRequest.a_coin:type_name -> cosmos.base.v1beta1.Coin + 10, // 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 + 8, // 7: testpb.EchoRequest.durations:type_name -> google.protobuf.Duration 2, // 8: testpb.EchoRequest.some_messages:type_name -> testpb.AMessage - 6, // 9: testpb.EchoRequest.positional3_varargs:type_name -> cosmos.base.v1beta1.Coin - 1, // 10: testpb.EchoResponse.request:type_name -> testpb.EchoRequest - 1, // 11: testpb.Query.Echo:input_type -> testpb.EchoRequest - 3, // 12: testpb.Query.Echo:output_type -> testpb.EchoResponse - 12, // [12:13] is the sub-list for method output_type - 11, // [11:12] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 9, // 9: testpb.EchoRequest.positional3_varargs:type_name -> cosmos.base.v1beta1.Coin + 4, // 10: testpb.EchoRequest.map_string_string:type_name -> testpb.EchoRequest.MapStringStringEntry + 5, // 11: testpb.EchoRequest.map_string_uint32:type_name -> testpb.EchoRequest.MapStringUint32Entry + 6, // 12: testpb.EchoRequest.map_string_coin:type_name -> testpb.EchoRequest.MapStringCoinEntry + 1, // 13: testpb.EchoResponse.request:type_name -> testpb.EchoRequest + 9, // 14: testpb.EchoRequest.MapStringCoinEntry.value:type_name -> cosmos.base.v1beta1.Coin + 1, // 15: testpb.Query.Echo:input_type -> testpb.EchoRequest + 3, // 16: testpb.Query.Echo:output_type -> testpb.EchoResponse + 16, // [16:17] is the sub-list for method output_type + 15, // [15:16] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name } func init() { file_testpb_query_proto_init() } @@ -4125,7 +5111,7 @@ func file_testpb_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_testpb_query_proto_rawDesc, NumEnums: 1, - NumMessages: 3, + NumMessages: 6, NumExtensions: 0, NumServices: 1, },