From a0e69bdfd8a67696aec7a4b7c0f6132aef28505e Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Tue, 13 Feb 2024 16:42:44 +0330 Subject: [PATCH 1/6] Move query methods to queryServer struct --- .../plugin/testdata/execute_ok/go.mod | 8 +++---- .../x/{{moduleName}}/keeper/query.go.plush | 11 +++++++++- .../keeper/query_params.go.plush | 4 ++-- .../keeper/query_params_test.go.plush | 8 ++++--- .../x/{{moduleName}}/module/module.go.plush | 2 +- .../keeper/query_{{queryName}}.go.plush | 2 +- .../keeper/query_{{typeName}}.go.plush | 10 ++++----- .../keeper/query_{{typeName}}_test.go.plush | 21 +++++++++++-------- .../keeper/query_{{typeName}}.go.plush | 10 ++++----- .../keeper/query_{{typeName}}_test.go.plush | 21 +++++++++++-------- .../keeper/query_{{typeName}}.go.plush | 4 ++-- .../keeper/query_{{typeName}}_test.go.plush | 7 ++++--- 12 files changed, 63 insertions(+), 45 deletions(-) diff --git a/ignite/internal/plugin/testdata/execute_ok/go.mod b/ignite/internal/plugin/testdata/execute_ok/go.mod index ec82dd2fcf..d2c08b9f14 100644 --- a/ignite/internal/plugin/testdata/execute_ok/go.mod +++ b/ignite/internal/plugin/testdata/execute_ok/go.mod @@ -81,13 +81,13 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect go.etcd.io/bbolt v1.3.8 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20231108232855-2478ac86f678 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/term v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.15.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query.go.plush index dbdb2d2ea1..cec810ce8e 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query.go.plush @@ -4,4 +4,13 @@ import ( "<%= modulePath %>/x/<%= moduleName %>/types" ) -var _ types.QueryServer = Keeper{} +var _ types.QueryServer = queryServer{} + +type queryServer struct { + k Keeper +} + +// NewQueryServerImpl returns an implementation of the QueryServer interface. +func NewQueryServerImpl(k Keeper) types.QueryServer { + return queryServer{k} +} \ No newline at end of file diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params.go.plush index 4d54fc5cae..cce5ceb3b0 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params.go.plush @@ -10,11 +10,11 @@ import ( "<%= modulePath %>/x/<%= moduleName %>/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (s queryServer) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + return &types.QueryParamsResponse{Params: s.k.GetParams(ctx)}, nil } diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush index c3ff71962e..998f7355ee 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/keeper/query_params_test.go.plush @@ -6,15 +6,17 @@ import ( "github.com/stretchr/testify/require" keepertest "<%= modulePath %>/testutil/keeper" + "<%= modulePath %>/x/<%= moduleName %>/keeper" "<%= modulePath %>/x/<%= moduleName %>/types" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := keepertest.<%= title(moduleName) %>Keeper(t) + k, ctx := keepertest.<%= title(moduleName) %>Keeper(t) + qs := keeper.NewQueryServerImpl(k) params := types.DefaultParams() - require.NoError(t, keeper.SetParams(ctx, params)) + require.NoError(t, k.SetParams(ctx, params)) - response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + response, err := qs.Params(ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.Equal(t, &types.QueryParamsResponse{Params: params}, response) } diff --git a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush index 3cb2ced633..e604d32f69 100644 --- a/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush +++ b/ignite/templates/module/create/files/base/x/{{moduleName}}/module/module.go.plush @@ -131,7 +131,7 @@ func NewAppModule( // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper)) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) diff --git a/ignite/templates/query/files/x/{{moduleName}}/keeper/query_{{queryName}}.go.plush b/ignite/templates/query/files/x/{{moduleName}}/keeper/query_{{queryName}}.go.plush index b4cccf5ffa..09bab06eac 100644 --- a/ignite/templates/query/files/x/{{moduleName}}/keeper/query_{{queryName}}.go.plush +++ b/ignite/templates/query/files/x/{{moduleName}}/keeper/query_{{queryName}}.go.plush @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) <%= QueryName.UpperCamel %>(goCtx context.Context, req *types.Query<%= QueryName.UpperCamel %>Request) (*types.Query<%= QueryName.UpperCamel %>Response, error) { +func (s queryServer) <%= QueryName.UpperCamel %>(goCtx context.Context, req *types.Query<%= QueryName.UpperCamel %>Request) (*types.Query<%= QueryName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index 672542dd15..173b62df8a 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -12,19 +12,19 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } var <%= TypeName.LowerCamel %>s []types.<%= TypeName.UpperCamel %> - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := runtime.KVStoreAdapter(s.k.storeService.OpenKVStore(ctx)) <%= TypeName.LowerCamel %>Store := prefix.NewStore(store, types.KeyPrefix(types.<%= TypeName.UpperCamel %>Key)) pageRes, err := query.Paginate(<%= TypeName.LowerCamel %>Store, req.Pagination, func(key []byte, value []byte) error { var <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %> - if err := k.cdc.Unmarshal(value, &<%= TypeName.LowerCamel %>); err != nil { + if err := s.k.cdc.Unmarshal(value, &<%= TypeName.LowerCamel %>); err != nil { return err } @@ -39,12 +39,12 @@ func (k Keeper) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.Qu return &types.QueryAll<%= TypeName.UpperCamel %>Response{<%= TypeName.UpperCamel %>: <%= TypeName.LowerCamel %>s, Pagination: pageRes}, nil } -func (k Keeper) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - <%= TypeName.LowerCamel %>, found := k.Get<%= TypeName.UpperCamel %>(ctx, req.Id) + <%= TypeName.LowerCamel %>, found := s.k.Get<%= TypeName.UpperCamel %>(ctx, req.Id) if !found { return nil, sdkerrors.ErrKeyNotFound } diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 04d5ac1fa3..1209623467 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -11,12 +11,14 @@ import ( "<%= ModulePath %>/x/<%= ModuleName %>/types" "<%= ModulePath %>/testutil/nullify" + "<%= ModulePath %>/x/<%= ModuleName %>/keeper" keepertest "<%= ModulePath %>/testutil/keeper" ) func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { - keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 2) + k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) + qs := keeper.NewQueryServerImpl(k) + msgs := createN<%= TypeName.UpperCamel %>(k, ctx, 2) tests := []struct { desc string request *types.QueryGet<%= TypeName.UpperCamel %>Request @@ -45,7 +47,7 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.<%= TypeName.UpperCamel %>(ctx, tc.request) + response, err := qs.<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -60,8 +62,9 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { - keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 5) + k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) + qs := keeper.NewQueryServerImpl(k) + msgs := createN<%= TypeName.UpperCamel %>(k, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAll<%= TypeName.UpperCamel %>Request { return &types.QueryAll<%= TypeName.UpperCamel %>Request{ @@ -76,7 +79,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) + resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -89,7 +92,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) + resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -100,7 +103,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) + resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -109,7 +112,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.<%= TypeName.UpperCamel %>All(ctx, nil) + _, err := qs.<%= TypeName.UpperCamel %>All(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index baf3e232c2..df676a9c90 100644 --- a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -11,19 +11,19 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } var <%= TypeName.LowerCamel %>s []types.<%= TypeName.UpperCamel %> - store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := runtime.KVStoreAdapter(s.k.storeService.OpenKVStore(ctx)) <%= TypeName.LowerCamel %>Store := prefix.NewStore(store, types.KeyPrefix(types.<%= TypeName.UpperCamel %>KeyPrefix)) pageRes, err := query.Paginate(<%= TypeName.LowerCamel %>Store, req.Pagination, func(key []byte, value []byte) error { var <%= TypeName.LowerCamel %> types.<%= TypeName.UpperCamel %> - if err := k.cdc.Unmarshal(value, &<%= TypeName.LowerCamel %>); err != nil { + if err := s.k.cdc.Unmarshal(value, &<%= TypeName.LowerCamel %>); err != nil { return err } @@ -38,12 +38,12 @@ func (k Keeper) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.Qu return &types.QueryAll<%= TypeName.UpperCamel %>Response{<%= TypeName.UpperCamel %>: <%= TypeName.LowerCamel %>s, Pagination: pageRes}, nil } -func (k Keeper) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - val, found := k.Get<%= TypeName.UpperCamel %>( + val, found := s.k.Get<%= TypeName.UpperCamel %>( ctx, <%= for (i, index) in Indexes { %>req.<%= index.Name.UpperCamel %>, <% } %>) diff --git a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 351254fe74..0f1eb7d6a0 100644 --- a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -11,6 +11,7 @@ import ( "<%= ModulePath %>/x/<%= ModuleName %>/types" "<%= ModulePath %>/testutil/nullify" + "<%= ModulePath %>/x/<%= ModuleName %>/keeper" keepertest "<%= ModulePath %>/testutil/keeper" ) @@ -18,8 +19,9 @@ import ( var _ = strconv.IntSize func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { - keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 2) + k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) + qs := keeper.NewQueryServerImpl(k) + msgs := createN<%= TypeName.UpperCamel %>(k, ctx, 2) tests := []struct { desc string request *types.QueryGet<%= TypeName.UpperCamel %>Request @@ -57,7 +59,7 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.<%= TypeName.UpperCamel %>(ctx, tc.request) + response, err := qs.<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -72,8 +74,9 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { - keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - msgs := createN<%= TypeName.UpperCamel %>(keeper, ctx, 5) + k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) + qs := keeper.NewQueryServerImpl(k) + msgs := createN<%= TypeName.UpperCamel %>(k, ctx, 5) request := func(next []byte, offset, limit uint64, total bool) *types.QueryAll<%= TypeName.UpperCamel %>Request { return &types.QueryAll<%= TypeName.UpperCamel %>Request{ @@ -88,7 +91,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) + resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -101,7 +104,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) + resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -112,7 +115,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) + resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -121,7 +124,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.<%= TypeName.UpperCamel %>All(ctx, nil) + _, err := qs.<%= TypeName.UpperCamel %>All(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index 7bae036019..ed91a314bf 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -9,13 +9,13 @@ import ( "google.golang.org/grpc/status" ) -func (k Keeper) <%= TypeName.UpperCamel %>(goCtx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) <%= TypeName.UpperCamel %>(goCtx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(goCtx) - val, found := k.Get<%= TypeName.UpperCamel %>(ctx) + val, found := s.k.Get<%= TypeName.UpperCamel %>(ctx) if !found { return nil, status.Error(codes.NotFound, "not found") } diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 47f50cfb76..fda6d1dfcc 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -13,8 +13,9 @@ import ( ) func Test<%= TypeName.UpperCamel %>Query(t *testing.T) { - keeper, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) - item := createTest<%= TypeName.UpperCamel %>(keeper, ctx) + k, ctx := keepertest.<%= title(ModuleName) %>Keeper(t) + qs := keeper.NewQueryServerImpl(k) + item := createTest<%= TypeName.UpperCamel %>(k, ctx) tests := []struct { desc string request *types.QueryGet<%= TypeName.UpperCamel %>Request @@ -33,7 +34,7 @@ func Test<%= TypeName.UpperCamel %>Query(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.<%= TypeName.UpperCamel %>(ctx, tc.request) + response, err := qs.<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { From be0390f1b9323ce6427a581f1f2efb08e530272c Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Tue, 13 Feb 2024 17:30:50 +0330 Subject: [PATCH 2/6] Rename show-x queries to get-x --- .../{{moduleName}}/keeper/query_{{typeName}}.go.plush | 4 ++-- .../keeper/query_{{typeName}}_test.go.plush | 10 +++++----- ignite/templates/typed/list/list.go | 11 ++++++----- .../{{moduleName}}/keeper/query_{{typeName}}.go.plush | 4 ++-- .../keeper/query_{{typeName}}_test.go.plush | 10 +++++----- ignite/templates/typed/map/map.go | 11 ++++++----- .../{{moduleName}}/keeper/query_{{typeName}}.go.plush | 2 +- .../keeper/query_{{typeName}}_test.go.plush | 2 +- 8 files changed, 28 insertions(+), 26 deletions(-) diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index 173b62df8a..874df38912 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc/status" ) -func (s queryServer) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) List<%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -39,7 +39,7 @@ func (s queryServer) <%= TypeName.UpperCamel %>All(ctx context.Context, req *typ return &types.QueryAll<%= TypeName.UpperCamel %>Response{<%= TypeName.UpperCamel %>: <%= TypeName.LowerCamel %>s, Pagination: pageRes}, nil } -func (s queryServer) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) Get<%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 1209623467..b90930d44e 100644 --- a/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/list/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -47,7 +47,7 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := qs.<%= TypeName.UpperCamel %>(ctx, tc.request) + response, err := qs.Get<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -79,7 +79,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) + resp, err := qs.List<%= TypeName.UpperCamel %>(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -92,7 +92,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) + resp, err := qs.List<%= TypeName.UpperCamel %>(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -103,7 +103,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) + resp, err := qs.List<%= TypeName.UpperCamel %>(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -112,7 +112,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := qs.<%= TypeName.UpperCamel %>All(ctx, nil) + _, err := qs.List<%= TypeName.UpperCamel %>(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/ignite/templates/typed/list/list.go b/ignite/templates/typed/list/list.go index 251008fb8e..c3c392e15d 100644 --- a/ignite/templates/typed/list/list.go +++ b/ignite/templates/typed/list/list.go @@ -218,7 +218,7 @@ func protoQueryModify(opts *typed.Options) genny.RunFn { appModulePath := gomodulepath.ExtractAppPath(opts.ModulePath) typenameUpper := opts.TypeName.UpperCamel rpcQueryGet := protoutil.NewRPC( - typenameUpper, + fmt.Sprintf("Get%s", typenameUpper), fmt.Sprintf("QueryGet%sRequest", typenameUpper), fmt.Sprintf("QueryGet%sResponse", typenameUpper), protoutil.WithRPCOptions( @@ -236,7 +236,7 @@ func protoQueryModify(opts *typed.Options) genny.RunFn { protoutil.AttachComment(rpcQueryGet, fmt.Sprintf("Queries a %v by id.", typenameUpper)) rpcQueryAll := protoutil.NewRPC( - fmt.Sprintf("%sAll", typenameUpper), + fmt.Sprintf("List%s", typenameUpper), fmt.Sprintf("QueryAll%sRequest", typenameUpper), fmt.Sprintf("QueryAll%sResponse", typenameUpper), protoutil.WithRPCOptions( @@ -387,14 +387,15 @@ func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) ge } template := `{ - RpcMethod: "%[2]vAll", + RpcMethod: "List%[2]v", Use: "list-%[3]v", Short: "List all %[4]v", }, { - RpcMethod: "%[2]v", - Use: "show-%[3]v [id]", + RpcMethod: "Get%[2]v", + Use: "get-%[3]v [id]", Short: "Shows a %[4]v by id", + Alias: []string{"show-%[3]v"}, PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}}, }, %[1]v` diff --git a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index df676a9c90..437bf3a53c 100644 --- a/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/map/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -11,7 +11,7 @@ import ( "google.golang.org/grpc/status" ) -func (s queryServer) <%= TypeName.UpperCamel %>All(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) List<%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryAll<%= TypeName.UpperCamel %>Request) (*types.QueryAll<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -38,7 +38,7 @@ func (s queryServer) <%= TypeName.UpperCamel %>All(ctx context.Context, req *typ return &types.QueryAll<%= TypeName.UpperCamel %>Response{<%= TypeName.UpperCamel %>: <%= TypeName.LowerCamel %>s, Pagination: pageRes}, nil } -func (s queryServer) <%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) Get<%= TypeName.UpperCamel %>(ctx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index 0f1eb7d6a0..cbf15f77d8 100644 --- a/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/map/files/tests/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -59,7 +59,7 @@ func Test<%= TypeName.UpperCamel %>QuerySingle(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := qs.<%= TypeName.UpperCamel %>(ctx, tc.request) + response, err := qs.Get<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { @@ -91,7 +91,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { t.Run("ByOffset", func(t *testing.T) { step := 2 for i := 0; i < len(msgs); i += step { - resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, uint64(i), uint64(step), false)) + resp, err := qs.List<%= TypeName.UpperCamel %>(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -104,7 +104,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { step := 2 var next []byte for i := 0; i < len(msgs); i += step { - resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(next, 0, uint64(step), false)) + resp, err := qs.List<%= TypeName.UpperCamel %>(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) require.LessOrEqual(t, len(resp.<%= TypeName.UpperCamel %>), step) require.Subset(t, @@ -115,7 +115,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { } }) t.Run("Total", func(t *testing.T) { - resp, err := qs.<%= TypeName.UpperCamel %>All(ctx, request(nil, 0, 0, true)) + resp, err := qs.List<%= TypeName.UpperCamel %>(ctx, request(nil, 0, 0, true)) require.NoError(t, err) require.Equal(t, len(msgs), int(resp.Pagination.Total)) require.ElementsMatch(t, @@ -124,7 +124,7 @@ func Test<%= TypeName.UpperCamel %>QueryPaginated(t *testing.T) { ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := qs.<%= TypeName.UpperCamel %>All(ctx, nil) + _, err := qs.List<%= TypeName.UpperCamel %>(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/ignite/templates/typed/map/map.go b/ignite/templates/typed/map/map.go index 5a2f817f05..db3220ef52 100644 --- a/ignite/templates/typed/map/map.go +++ b/ignite/templates/typed/map/map.go @@ -150,7 +150,7 @@ func protoRPCModify(opts *typed.Options) genny.RunFn { } typenameUpper, typenameSnake, typenameLower := opts.TypeName.UpperCamel, opts.TypeName.Snake, opts.TypeName.LowerCamel rpcQueryGet := protoutil.NewRPC( - typenameUpper, + fmt.Sprintf("Get%s", typenameUpper), fmt.Sprintf("QueryGet%sRequest", typenameUpper), fmt.Sprintf("QueryGet%sResponse", typenameUpper), protoutil.WithRPCOptions( @@ -168,7 +168,7 @@ func protoRPCModify(opts *typed.Options) genny.RunFn { protoutil.AttachComment(rpcQueryGet, fmt.Sprintf("Queries a %v by index.", typenameUpper)) rpcQueryAll := protoutil.NewRPC( - fmt.Sprintf("%sAll", typenameUpper), + fmt.Sprintf("List%s", typenameUpper), fmt.Sprintf("QueryAll%sRequest", typenameUpper), fmt.Sprintf("QueryAll%sResponse", typenameUpper), protoutil.WithRPCOptions( @@ -254,14 +254,15 @@ func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) ge } template := `{ - RpcMethod: "%[2]vAll", + RpcMethod: "List%[2]v", Use: "list-%[3]v", Short: "List all %[4]v", }, { - RpcMethod: "%[2]v", - Use: "show-%[3]v [id]", + RpcMethod: "Get%[2]v", + Use: "get-%[3]v [id]", Short: "Shows a %[4]v", + Alias: []string{"show-%[3]v"}, PositionalArgs: []*autocliv1.PositionalArgDescriptor{%s}, }, %[1]v` diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush index ed91a314bf..d4f7e4bcdf 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}.go.plush @@ -9,7 +9,7 @@ import ( "google.golang.org/grpc/status" ) -func (s queryServer) <%= TypeName.UpperCamel %>(goCtx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { +func (s queryServer) Get<%= TypeName.UpperCamel %>(goCtx context.Context, req *types.QueryGet<%= TypeName.UpperCamel %>Request) (*types.QueryGet<%= TypeName.UpperCamel %>Response, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush index fda6d1dfcc..690cd7d0e9 100644 --- a/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush +++ b/ignite/templates/typed/singleton/files/component/x/{{moduleName}}/keeper/query_{{typeName}}_test.go.plush @@ -34,7 +34,7 @@ func Test<%= TypeName.UpperCamel %>Query(t *testing.T) { } for _, tc := range tests { t.Run(tc.desc, func(t *testing.T) { - response, err := qs.<%= TypeName.UpperCamel %>(ctx, tc.request) + response, err := qs.Get<%= TypeName.UpperCamel %>(ctx, tc.request) if tc.err != nil { require.ErrorIs(t, err, tc.err) } else { From 9d83e73adaa55aa2b4fdf8aac7de72075e35cb43 Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Tue, 13 Feb 2024 18:06:47 +0330 Subject: [PATCH 3/6] Fix map queries bug --- ignite/templates/typed/list/list.go | 2 +- ignite/templates/typed/map/map.go | 4 ++-- ignite/templates/typed/singleton/singleton.go | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ignite/templates/typed/list/list.go b/ignite/templates/typed/list/list.go index c3c392e15d..850b6c89c5 100644 --- a/ignite/templates/typed/list/list.go +++ b/ignite/templates/typed/list/list.go @@ -394,7 +394,7 @@ func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) ge { RpcMethod: "Get%[2]v", Use: "get-%[3]v [id]", - Short: "Shows a %[4]v by id", + Short: "Gets a %[4]v by id", Alias: []string{"show-%[3]v"}, PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "id"}}, }, diff --git a/ignite/templates/typed/map/map.go b/ignite/templates/typed/map/map.go index db3220ef52..b8fda5cd9a 100644 --- a/ignite/templates/typed/map/map.go +++ b/ignite/templates/typed/map/map.go @@ -261,9 +261,9 @@ func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) ge { RpcMethod: "Get%[2]v", Use: "get-%[3]v [id]", - Short: "Shows a %[4]v", + Short: "Gets a %[4]v", Alias: []string{"show-%[3]v"}, - PositionalArgs: []*autocliv1.PositionalArgDescriptor{%s}, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{%[5]s}, }, %[1]v` replacement := fmt.Sprintf( diff --git a/ignite/templates/typed/singleton/singleton.go b/ignite/templates/typed/singleton/singleton.go index 066a4ee8de..651b2147ef 100644 --- a/ignite/templates/typed/singleton/singleton.go +++ b/ignite/templates/typed/singleton/singleton.go @@ -128,7 +128,7 @@ func protoRPCModify(opts *typed.Options) genny.RunFn { appModulePath := gomodulepath.ExtractAppPath(opts.ModulePath) typenameUpper := opts.TypeName.UpperCamel rpcQueryGet := protoutil.NewRPC( - typenameUpper, + fmt.Sprintf("Get%s", typenameUpper), fmt.Sprintf("QueryGet%sRequest", typenameUpper), fmt.Sprintf("QueryGet%sResponse", typenameUpper), protoutil.WithRPCOptions( @@ -169,8 +169,9 @@ func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) ge template := `{ RpcMethod: "%[2]v", - Use: "show-%[3]v", - Short: "show %[4]v", + Use: "get-%[3]v", + Short: "Gets a %[4]v", + Alias: []string{"show-%[3]v"}, }, %[1]v` replacement := fmt.Sprintf( From 8f22c96ec434fdbc1a5f3dab94bbdf253c01fcd6 Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Tue, 13 Feb 2024 18:09:00 +0330 Subject: [PATCH 4/6] Update changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 24826ad788..a62432a4f4 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ ### Changes - [#3959](https://github.com/ignite/cli/pull/3959) Remove app name prefix from the `.gitignore` file +- [#3962](https://github.com/ignite/cli/pull/3962) Rename `map`/`list`/`single` query type names and cli commands ### Fixes From c4265a77ae13f290ae5626ce326be555167a8b5d Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Wed, 14 Feb 2024 12:30:00 +0330 Subject: [PATCH 5/6] More descriptive changelog --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index a62432a4f4..64e7ad4548 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,7 @@ ### Changes - [#3959](https://github.com/ignite/cli/pull/3959) Remove app name prefix from the `.gitignore` file -- [#3962](https://github.com/ignite/cli/pull/3962) Rename `map`/`list`/`single` query type names and cli commands +- [#3962](https://github.com/ignite/cli/pull/3962) Rename all RPC endpoints and autocli commands generated for `map`/`list`/`single` types ### Fixes From 5d27fd1ec9fdfc79cdf68f18796e2dd501b941e2 Mon Sep 17 00:00:00 2001 From: Ehsan-saradar Date: Wed, 14 Feb 2024 13:16:34 +0330 Subject: [PATCH 6/6] Fix singleton cli bug --- ignite/templates/typed/singleton/singleton.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ignite/templates/typed/singleton/singleton.go b/ignite/templates/typed/singleton/singleton.go index 651b2147ef..c2cf350ec5 100644 --- a/ignite/templates/typed/singleton/singleton.go +++ b/ignite/templates/typed/singleton/singleton.go @@ -168,7 +168,7 @@ func clientCliQueryModify(replacer placeholder.Replacer, opts *typed.Options) ge } template := `{ - RpcMethod: "%[2]v", + RpcMethod: "Get%[2]v", Use: "get-%[3]v", Short: "Gets a %[4]v", Alias: []string{"show-%[3]v"},