From 90030f291ccce3acba0352003e8318e28b6f6cc7 Mon Sep 17 00:00:00 2001 From: Yury Frolov Date: Wed, 14 Feb 2024 15:50:54 +0300 Subject: [PATCH] Fixed lint --- router/mock/qrouter/mock_qrouter.go | 11 +++++++---- router/qrouter/proxy_routing.go | 6 +----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/router/mock/qrouter/mock_qrouter.go b/router/mock/qrouter/mock_qrouter.go index 19ef81102..182b78b55 100644 --- a/router/mock/qrouter/mock_qrouter.go +++ b/router/mock/qrouter/mock_qrouter.go @@ -6,6 +6,7 @@ package mock import ( context "context" + "github.com/pg-sharding/spqr/pkg/models/kr" reflect "reflect" gomock "github.com/golang/mock/gomock" @@ -22,6 +23,8 @@ type MockQueryRouter struct { recorder *MockQueryRouterMockRecorder } +var _ qrouter.QueryRouter = &MockQueryRouter{} + // MockQueryRouterMockRecorder is the mock recorder for MockQueryRouter. type MockQueryRouterMockRecorder struct { mock *MockQueryRouter @@ -54,18 +57,18 @@ func (mr *MockQueryRouterMockRecorder) DataShardsRoutes() *gomock.Call { } // DeparseKeyWithRangesInternal mocks base method. -func (m *MockQueryRouter) DeparseKeyWithRangesInternal(ctx context.Context, key string, meta *qrouter.RoutingMetadataContext) (*routingstate.DataShardRoute, error) { +func (m *MockQueryRouter) DeparseKeyWithRangesInternal(ctx context.Context, key string, krs []*kr.KeyRange) (*routingstate.DataShardRoute, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeparseKeyWithRangesInternal", ctx, key, meta) + ret := m.ctrl.Call(m, "DeparseKeyWithRangesInternal", ctx, key, krs) ret0, _ := ret[0].(*routingstate.DataShardRoute) ret1, _ := ret[1].(error) return ret0, ret1 } // DeparseKeyWithRangesInternal indicates an expected call of DeparseKeyWithRangesInternal. -func (mr *MockQueryRouterMockRecorder) DeparseKeyWithRangesInternal(ctx, key, meta interface{}) *gomock.Call { +func (mr *MockQueryRouterMockRecorder) DeparseKeyWithRangesInternal(ctx, key, krs interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeparseKeyWithRangesInternal", reflect.TypeOf((*MockQueryRouter)(nil).DeparseKeyWithRangesInternal), ctx, key, meta) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeparseKeyWithRangesInternal", reflect.TypeOf((*MockQueryRouter)(nil).DeparseKeyWithRangesInternal), ctx, key, krs) } // Initialize mocks base method. diff --git a/router/qrouter/proxy_routing.go b/router/qrouter/proxy_routing.go index 1fb8a4593..72dedb4af 100644 --- a/router/qrouter/proxy_routing.go +++ b/router/qrouter/proxy_routing.go @@ -726,10 +726,6 @@ func (qr *ProxyQrouter) routeWithRules(ctx context.Context, stmt lyx.Node, sph s } /* TODO: delay this until step 2. */ - krs, err := qr.mgr.ListKeyRanges(ctx, queryDistribution) - if err != nil { - return nil, err - } meta := NewRoutingMetadataContext(queryDistribution, sph.BindParams(), sph.BindParamFormatCodes()) @@ -982,7 +978,7 @@ func (qr *ProxyQrouter) routeWithRules(ctx context.Context, stmt lyx.Node, sph s if err != nil { return nil, err } - krs, err = qr.mgr.ListKeyRanges(ctx, ds.Id) + krs, err := qr.mgr.ListKeyRanges(ctx, ds.Id) if err != nil { return nil, err }