diff --git a/go.mod b/go.mod index 5bc0470..ca3d82c 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module github.com/i-sevostyanov/NanoDB go 1.22 require ( - github.com/golang/mock v1.6.0 github.com/olekukonko/tablewriter v0.0.5 github.com/stretchr/testify v1.9.0 + go.uber.org/mock v0.4.0 ) require ( @@ -13,5 +13,7 @@ require ( github.com/mattn/go-runewidth v0.0.15 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/tools v0.21.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 53adcfd..db0c905 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -14,29 +12,14 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/sql/engine/engine.go b/internal/sql/engine/engine.go index 3298e9f..d3b0c49 100644 --- a/internal/sql/engine/engine.go +++ b/internal/sql/engine/engine.go @@ -8,7 +8,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql/planning/plan" ) -//go:generate mockgen -source=engine.go -destination ./engine_mock_test.go -package engine_test +//go:generate go run go.uber.org/mock/mockgen -typed -source=engine.go -destination ./engine_mock_test.go -package engine_test type Parser interface { Parse(sql string) (ast.Node, error) diff --git a/internal/sql/engine/engine_mock_test.go b/internal/sql/engine/engine_mock_test.go index b2f9971..30a443f 100644 --- a/internal/sql/engine/engine_mock_test.go +++ b/internal/sql/engine/engine_mock_test.go @@ -1,40 +1,46 @@ // Code generated by MockGen. DO NOT EDIT. // Source: engine.go +// +// Generated by this command: +// +// mockgen -typed -source=engine.go -destination ./engine_mock_test.go -package engine_test +// // Package engine_test is a generated GoMock package. package engine_test import ( - gomock "github.com/golang/mock/gomock" + reflect "reflect" + ast "github.com/i-sevostyanov/NanoDB/internal/sql/parsing/ast" plan "github.com/i-sevostyanov/NanoDB/internal/sql/planning/plan" - reflect "reflect" + gomock "go.uber.org/mock/gomock" ) -// MockParser is a mock of Parser interface +// MockParser is a mock of Parser interface. type MockParser struct { ctrl *gomock.Controller recorder *MockParserMockRecorder } -// MockParserMockRecorder is the mock recorder for MockParser +// MockParserMockRecorder is the mock recorder for MockParser. type MockParserMockRecorder struct { mock *MockParser } -// NewMockParser creates a new mock instance +// NewMockParser creates a new mock instance. func NewMockParser(ctrl *gomock.Controller) *MockParser { mock := &MockParser{ctrl: ctrl} mock.recorder = &MockParserMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockParser) EXPECT() *MockParserMockRecorder { return m.recorder } -// Parse mocks base method +// Parse mocks base method. func (m *MockParser) Parse(sql string) (ast.Node, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Parse", sql) @@ -43,36 +49,60 @@ func (m *MockParser) Parse(sql string) (ast.Node, error) { return ret0, ret1 } -// Parse indicates an expected call of Parse -func (mr *MockParserMockRecorder) Parse(sql interface{}) *gomock.Call { +// Parse indicates an expected call of Parse. +func (mr *MockParserMockRecorder) Parse(sql any) *MockParserParseCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Parse", reflect.TypeOf((*MockParser)(nil).Parse), sql) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Parse", reflect.TypeOf((*MockParser)(nil).Parse), sql) + return &MockParserParseCall{Call: call} +} + +// MockParserParseCall wrap *gomock.Call +type MockParserParseCall struct { + *gomock.Call } -// MockPlanner is a mock of Planner interface +// Return rewrite *gomock.Call.Return +func (c *MockParserParseCall) Return(arg0 ast.Node, arg1 error) *MockParserParseCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockParserParseCall) Do(f func(string) (ast.Node, error)) *MockParserParseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockParserParseCall) DoAndReturn(f func(string) (ast.Node, error)) *MockParserParseCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MockPlanner is a mock of Planner interface. type MockPlanner struct { ctrl *gomock.Controller recorder *MockPlannerMockRecorder } -// MockPlannerMockRecorder is the mock recorder for MockPlanner +// MockPlannerMockRecorder is the mock recorder for MockPlanner. type MockPlannerMockRecorder struct { mock *MockPlanner } -// NewMockPlanner creates a new mock instance +// NewMockPlanner creates a new mock instance. func NewMockPlanner(ctrl *gomock.Controller) *MockPlanner { mock := &MockPlanner{ctrl: ctrl} mock.recorder = &MockPlannerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockPlanner) EXPECT() *MockPlannerMockRecorder { return m.recorder } -// Plan mocks base method +// Plan mocks base method. func (m *MockPlanner) Plan(database string, node ast.Node) (plan.Node, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Plan", database, node) @@ -81,8 +111,32 @@ func (m *MockPlanner) Plan(database string, node ast.Node) (plan.Node, error) { return ret0, ret1 } -// Plan indicates an expected call of Plan -func (mr *MockPlannerMockRecorder) Plan(database, node interface{}) *gomock.Call { +// Plan indicates an expected call of Plan. +func (mr *MockPlannerMockRecorder) Plan(database, node any) *MockPlannerPlanCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Plan", reflect.TypeOf((*MockPlanner)(nil).Plan), database, node) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Plan", reflect.TypeOf((*MockPlanner)(nil).Plan), database, node) + return &MockPlannerPlanCall{Call: call} +} + +// MockPlannerPlanCall wrap *gomock.Call +type MockPlannerPlanCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockPlannerPlanCall) Return(arg0 plan.Node, arg1 error) *MockPlannerPlanCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockPlannerPlanCall) Do(f func(string, ast.Node) (plan.Node, error)) *MockPlannerPlanCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockPlannerPlanCall) DoAndReturn(f func(string, ast.Node) (plan.Node, error)) *MockPlannerPlanCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/engine/engine_test.go b/internal/sql/engine/engine_test.go index a29a389..bec4791 100644 --- a/internal/sql/engine/engine_test.go +++ b/internal/sql/engine/engine_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/engine" diff --git a/internal/sql/expr/binary_test.go b/internal/sql/expr/binary_test.go index 8104f06..0b487b2 100644 --- a/internal/sql/expr/binary_test.go +++ b/internal/sql/expr/binary_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/expr/expression.go b/internal/sql/expr/expression.go index 69adf4e..35b0151 100644 --- a/internal/sql/expr/expression.go +++ b/internal/sql/expr/expression.go @@ -8,7 +8,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql/parsing/token" ) -//go:generate mockgen -source=expression.go -destination ./expression_mock.go -package expr +//go:generate go run go.uber.org/mock/mockgen -typed -source=expression.go -destination ./expression_mock.go -package expr // Node is a combination of one or more SQL expressions. type Node interface { diff --git a/internal/sql/expr/expression_mock.go b/internal/sql/expr/expression_mock.go index 46b9e9e..5a4b40d 100644 --- a/internal/sql/expr/expression_mock.go +++ b/internal/sql/expr/expression_mock.go @@ -1,39 +1,84 @@ // Code generated by MockGen. DO NOT EDIT. // Source: expression.go +// +// Generated by this command: +// +// mockgen -typed -source=expression.go -destination ./expression_mock.go -package expr +// // Package expr is a generated GoMock package. package expr import ( - gomock "github.com/golang/mock/gomock" - sql "github.com/i-sevostyanov/NanoDB/internal/sql" reflect "reflect" + + sql "github.com/i-sevostyanov/NanoDB/internal/sql" + gomock "go.uber.org/mock/gomock" ) -// MockNode is a mock of Node interface +// MockNode is a mock of Node interface. type MockNode struct { ctrl *gomock.Controller recorder *MockNodeMockRecorder } -// MockNodeMockRecorder is the mock recorder for MockNode +// MockNodeMockRecorder is the mock recorder for MockNode. type MockNodeMockRecorder struct { mock *MockNode } -// NewMockNode creates a new mock instance +// NewMockNode creates a new mock instance. func NewMockNode(ctrl *gomock.Controller) *MockNode { mock := &MockNode{ctrl: ctrl} mock.recorder = &MockNodeMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockNode) EXPECT() *MockNodeMockRecorder { return m.recorder } -// String mocks base method +// Eval mocks base method. +func (m *MockNode) Eval(row sql.Row) (sql.Value, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Eval", row) + ret0, _ := ret[0].(sql.Value) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Eval indicates an expected call of Eval. +func (mr *MockNodeMockRecorder) Eval(row any) *MockNodeEvalCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eval", reflect.TypeOf((*MockNode)(nil).Eval), row) + return &MockNodeEvalCall{Call: call} +} + +// MockNodeEvalCall wrap *gomock.Call +type MockNodeEvalCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockNodeEvalCall) Return(arg0 sql.Value, arg1 error) *MockNodeEvalCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockNodeEvalCall) Do(f func(sql.Row) (sql.Value, error)) *MockNodeEvalCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockNodeEvalCall) DoAndReturn(f func(sql.Row) (sql.Value, error)) *MockNodeEvalCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// String mocks base method. func (m *MockNode) String() string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "String") @@ -41,23 +86,32 @@ func (m *MockNode) String() string { return ret0 } -// String indicates an expected call of String -func (mr *MockNodeMockRecorder) String() *gomock.Call { +// String indicates an expected call of String. +func (mr *MockNodeMockRecorder) String() *MockNodeStringCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockNode)(nil).String)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockNode)(nil).String)) + return &MockNodeStringCall{Call: call} } -// Eval mocks base method -func (m *MockNode) Eval(row sql.Row) (sql.Value, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Eval", row) - ret0, _ := ret[0].(sql.Value) - ret1, _ := ret[1].(error) - return ret0, ret1 +// MockNodeStringCall wrap *gomock.Call +type MockNodeStringCall struct { + *gomock.Call } -// Eval indicates an expected call of Eval -func (mr *MockNodeMockRecorder) Eval(row interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Eval", reflect.TypeOf((*MockNode)(nil).Eval), row) +// Return rewrite *gomock.Call.Return +func (c *MockNodeStringCall) Return(arg0 string) *MockNodeStringCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockNodeStringCall) Do(f func() string) *MockNodeStringCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockNodeStringCall) DoAndReturn(f func() string) *MockNodeStringCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/expr/unary_test.go b/internal/sql/expr/unary_test.go index a3d2c2d..0f34b3a 100644 --- a/internal/sql/expr/unary_test.go +++ b/internal/sql/expr/unary_test.go @@ -5,9 +5,9 @@ import ( "math" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/create.go b/internal/sql/planning/plan/create.go index 48a77d5..8cf53aa 100644 --- a/internal/sql/planning/plan/create.go +++ b/internal/sql/planning/plan/create.go @@ -6,7 +6,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql" ) -//go:generate mockgen -source=create.go -destination ./create_mock_test.go -package plan_test +//go:generate go run go.uber.org/mock/mockgen -typed -source=create.go -destination ./create_mock_test.go -package plan_test type DatabaseCreator interface { CreateDatabase(name string) (sql.Database, error) diff --git a/internal/sql/planning/plan/create_mock_test.go b/internal/sql/planning/plan/create_mock_test.go index 322812b..3617ae1 100644 --- a/internal/sql/planning/plan/create_mock_test.go +++ b/internal/sql/planning/plan/create_mock_test.go @@ -1,39 +1,45 @@ // Code generated by MockGen. DO NOT EDIT. // Source: create.go +// +// Generated by this command: +// +// mockgen -typed -source=create.go -destination ./create_mock_test.go -package plan_test +// // Package plan_test is a generated GoMock package. package plan_test import ( - gomock "github.com/golang/mock/gomock" - sql "github.com/i-sevostyanov/NanoDB/internal/sql" reflect "reflect" + + sql "github.com/i-sevostyanov/NanoDB/internal/sql" + gomock "go.uber.org/mock/gomock" ) -// MockDatabaseCreator is a mock of DatabaseCreator interface +// MockDatabaseCreator is a mock of DatabaseCreator interface. type MockDatabaseCreator struct { ctrl *gomock.Controller recorder *MockDatabaseCreatorMockRecorder } -// MockDatabaseCreatorMockRecorder is the mock recorder for MockDatabaseCreator +// MockDatabaseCreatorMockRecorder is the mock recorder for MockDatabaseCreator. type MockDatabaseCreatorMockRecorder struct { mock *MockDatabaseCreator } -// NewMockDatabaseCreator creates a new mock instance +// NewMockDatabaseCreator creates a new mock instance. func NewMockDatabaseCreator(ctrl *gomock.Controller) *MockDatabaseCreator { mock := &MockDatabaseCreator{ctrl: ctrl} mock.recorder = &MockDatabaseCreatorMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockDatabaseCreator) EXPECT() *MockDatabaseCreatorMockRecorder { return m.recorder } -// CreateDatabase mocks base method +// CreateDatabase mocks base method. func (m *MockDatabaseCreator) CreateDatabase(name string) (sql.Database, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateDatabase", name) @@ -42,36 +48,60 @@ func (m *MockDatabaseCreator) CreateDatabase(name string) (sql.Database, error) return ret0, ret1 } -// CreateDatabase indicates an expected call of CreateDatabase -func (mr *MockDatabaseCreatorMockRecorder) CreateDatabase(name interface{}) *gomock.Call { +// CreateDatabase indicates an expected call of CreateDatabase. +func (mr *MockDatabaseCreatorMockRecorder) CreateDatabase(name any) *MockDatabaseCreatorCreateDatabaseCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDatabase", reflect.TypeOf((*MockDatabaseCreator)(nil).CreateDatabase), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDatabase", reflect.TypeOf((*MockDatabaseCreator)(nil).CreateDatabase), name) + return &MockDatabaseCreatorCreateDatabaseCall{Call: call} +} + +// MockDatabaseCreatorCreateDatabaseCall wrap *gomock.Call +type MockDatabaseCreatorCreateDatabaseCall struct { + *gomock.Call } -// MockTableCreator is a mock of TableCreator interface +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseCreatorCreateDatabaseCall) Return(arg0 sql.Database, arg1 error) *MockDatabaseCreatorCreateDatabaseCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseCreatorCreateDatabaseCall) Do(f func(string) (sql.Database, error)) *MockDatabaseCreatorCreateDatabaseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseCreatorCreateDatabaseCall) DoAndReturn(f func(string) (sql.Database, error)) *MockDatabaseCreatorCreateDatabaseCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MockTableCreator is a mock of TableCreator interface. type MockTableCreator struct { ctrl *gomock.Controller recorder *MockTableCreatorMockRecorder } -// MockTableCreatorMockRecorder is the mock recorder for MockTableCreator +// MockTableCreatorMockRecorder is the mock recorder for MockTableCreator. type MockTableCreatorMockRecorder struct { mock *MockTableCreator } -// NewMockTableCreator creates a new mock instance +// NewMockTableCreator creates a new mock instance. func NewMockTableCreator(ctrl *gomock.Controller) *MockTableCreator { mock := &MockTableCreator{ctrl: ctrl} mock.recorder = &MockTableCreatorMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockTableCreator) EXPECT() *MockTableCreatorMockRecorder { return m.recorder } -// CreateTable mocks base method +// CreateTable mocks base method. func (m *MockTableCreator) CreateTable(name string, scheme sql.Scheme) (sql.Table, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateTable", name, scheme) @@ -80,8 +110,32 @@ func (m *MockTableCreator) CreateTable(name string, scheme sql.Scheme) (sql.Tabl return ret0, ret1 } -// CreateTable indicates an expected call of CreateTable -func (mr *MockTableCreatorMockRecorder) CreateTable(name, scheme interface{}) *gomock.Call { +// CreateTable indicates an expected call of CreateTable. +func (mr *MockTableCreatorMockRecorder) CreateTable(name, scheme any) *MockTableCreatorCreateTableCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTable", reflect.TypeOf((*MockTableCreator)(nil).CreateTable), name, scheme) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTable", reflect.TypeOf((*MockTableCreator)(nil).CreateTable), name, scheme) + return &MockTableCreatorCreateTableCall{Call: call} +} + +// MockTableCreatorCreateTableCall wrap *gomock.Call +type MockTableCreatorCreateTableCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableCreatorCreateTableCall) Return(arg0 sql.Table, arg1 error) *MockTableCreatorCreateTableCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableCreatorCreateTableCall) Do(f func(string, sql.Scheme) (sql.Table, error)) *MockTableCreatorCreateTableCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableCreatorCreateTableCall) DoAndReturn(f func(string, sql.Scheme) (sql.Table, error)) *MockTableCreatorCreateTableCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/planning/plan/create_test.go b/internal/sql/planning/plan/create_test.go index 258a924..4cb3d51 100644 --- a/internal/sql/planning/plan/create_test.go +++ b/internal/sql/planning/plan/create_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/planning/plan" diff --git a/internal/sql/planning/plan/delete.go b/internal/sql/planning/plan/delete.go index d3a9b00..88a659b 100644 --- a/internal/sql/planning/plan/delete.go +++ b/internal/sql/planning/plan/delete.go @@ -8,7 +8,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql" ) -//go:generate mockgen -source=delete.go -destination ./delete_mock_test.go -package plan_test +//go:generate go run go.uber.org/mock/mockgen -typed -source=delete.go -destination ./delete_mock_test.go -package plan_test type RowDeleter interface { Delete(key int64) error diff --git a/internal/sql/planning/plan/delete_mock_test.go b/internal/sql/planning/plan/delete_mock_test.go index 9456254..6be7382 100644 --- a/internal/sql/planning/plan/delete_mock_test.go +++ b/internal/sql/planning/plan/delete_mock_test.go @@ -1,38 +1,44 @@ // Code generated by MockGen. DO NOT EDIT. // Source: delete.go +// +// Generated by this command: +// +// mockgen -typed -source=delete.go -destination ./delete_mock_test.go -package plan_test +// // Package plan_test is a generated GoMock package. package plan_test import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "go.uber.org/mock/gomock" ) -// MockRowDeleter is a mock of RowDeleter interface +// MockRowDeleter is a mock of RowDeleter interface. type MockRowDeleter struct { ctrl *gomock.Controller recorder *MockRowDeleterMockRecorder } -// MockRowDeleterMockRecorder is the mock recorder for MockRowDeleter +// MockRowDeleterMockRecorder is the mock recorder for MockRowDeleter. type MockRowDeleterMockRecorder struct { mock *MockRowDeleter } -// NewMockRowDeleter creates a new mock instance +// NewMockRowDeleter creates a new mock instance. func NewMockRowDeleter(ctrl *gomock.Controller) *MockRowDeleter { mock := &MockRowDeleter{ctrl: ctrl} mock.recorder = &MockRowDeleterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRowDeleter) EXPECT() *MockRowDeleterMockRecorder { return m.recorder } -// Delete mocks base method +// Delete mocks base method. func (m *MockRowDeleter) Delete(key int64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Delete", key) @@ -40,8 +46,32 @@ func (m *MockRowDeleter) Delete(key int64) error { return ret0 } -// Delete indicates an expected call of Delete -func (mr *MockRowDeleterMockRecorder) Delete(key interface{}) *gomock.Call { +// Delete indicates an expected call of Delete. +func (mr *MockRowDeleterMockRecorder) Delete(key any) *MockRowDeleterDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRowDeleter)(nil).Delete), key) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRowDeleter)(nil).Delete), key) + return &MockRowDeleterDeleteCall{Call: call} +} + +// MockRowDeleterDeleteCall wrap *gomock.Call +type MockRowDeleterDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockRowDeleterDeleteCall) Return(arg0 error) *MockRowDeleterDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockRowDeleterDeleteCall) Do(f func(int64) error) *MockRowDeleterDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockRowDeleterDeleteCall) DoAndReturn(f func(int64) error) *MockRowDeleterDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/planning/plan/delete_test.go b/internal/sql/planning/plan/delete_test.go index e324663..fdff5dd 100644 --- a/internal/sql/planning/plan/delete_test.go +++ b/internal/sql/planning/plan/delete_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/drop.go b/internal/sql/planning/plan/drop.go index ee75e1a..e133dfc 100644 --- a/internal/sql/planning/plan/drop.go +++ b/internal/sql/planning/plan/drop.go @@ -6,7 +6,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql" ) -//go:generate mockgen -source=drop.go -destination ./drop_mock_test.go -package plan_test +//go:generate go run go.uber.org/mock/mockgen -typed -source=drop.go -destination ./drop_mock_test.go -package plan_test type DatabaseDropper interface { DropDatabase(name string) error diff --git a/internal/sql/planning/plan/drop_mock_test.go b/internal/sql/planning/plan/drop_mock_test.go index e42bb15..13031d9 100644 --- a/internal/sql/planning/plan/drop_mock_test.go +++ b/internal/sql/planning/plan/drop_mock_test.go @@ -1,38 +1,44 @@ // Code generated by MockGen. DO NOT EDIT. // Source: drop.go +// +// Generated by this command: +// +// mockgen -typed -source=drop.go -destination ./drop_mock_test.go -package plan_test +// // Package plan_test is a generated GoMock package. package plan_test import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "go.uber.org/mock/gomock" ) -// MockDatabaseDropper is a mock of DatabaseDropper interface +// MockDatabaseDropper is a mock of DatabaseDropper interface. type MockDatabaseDropper struct { ctrl *gomock.Controller recorder *MockDatabaseDropperMockRecorder } -// MockDatabaseDropperMockRecorder is the mock recorder for MockDatabaseDropper +// MockDatabaseDropperMockRecorder is the mock recorder for MockDatabaseDropper. type MockDatabaseDropperMockRecorder struct { mock *MockDatabaseDropper } -// NewMockDatabaseDropper creates a new mock instance +// NewMockDatabaseDropper creates a new mock instance. func NewMockDatabaseDropper(ctrl *gomock.Controller) *MockDatabaseDropper { mock := &MockDatabaseDropper{ctrl: ctrl} mock.recorder = &MockDatabaseDropperMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockDatabaseDropper) EXPECT() *MockDatabaseDropperMockRecorder { return m.recorder } -// DropDatabase mocks base method +// DropDatabase mocks base method. func (m *MockDatabaseDropper) DropDatabase(name string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DropDatabase", name) @@ -40,36 +46,60 @@ func (m *MockDatabaseDropper) DropDatabase(name string) error { return ret0 } -// DropDatabase indicates an expected call of DropDatabase -func (mr *MockDatabaseDropperMockRecorder) DropDatabase(name interface{}) *gomock.Call { +// DropDatabase indicates an expected call of DropDatabase. +func (mr *MockDatabaseDropperMockRecorder) DropDatabase(name any) *MockDatabaseDropperDropDatabaseCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropDatabase", reflect.TypeOf((*MockDatabaseDropper)(nil).DropDatabase), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropDatabase", reflect.TypeOf((*MockDatabaseDropper)(nil).DropDatabase), name) + return &MockDatabaseDropperDropDatabaseCall{Call: call} +} + +// MockDatabaseDropperDropDatabaseCall wrap *gomock.Call +type MockDatabaseDropperDropDatabaseCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseDropperDropDatabaseCall) Return(arg0 error) *MockDatabaseDropperDropDatabaseCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseDropperDropDatabaseCall) Do(f func(string) error) *MockDatabaseDropperDropDatabaseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseDropperDropDatabaseCall) DoAndReturn(f func(string) error) *MockDatabaseDropperDropDatabaseCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// MockTableDropper is a mock of TableDropper interface +// MockTableDropper is a mock of TableDropper interface. type MockTableDropper struct { ctrl *gomock.Controller recorder *MockTableDropperMockRecorder } -// MockTableDropperMockRecorder is the mock recorder for MockTableDropper +// MockTableDropperMockRecorder is the mock recorder for MockTableDropper. type MockTableDropperMockRecorder struct { mock *MockTableDropper } -// NewMockTableDropper creates a new mock instance +// NewMockTableDropper creates a new mock instance. func NewMockTableDropper(ctrl *gomock.Controller) *MockTableDropper { mock := &MockTableDropper{ctrl: ctrl} mock.recorder = &MockTableDropperMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockTableDropper) EXPECT() *MockTableDropperMockRecorder { return m.recorder } -// DropTable mocks base method +// DropTable mocks base method. func (m *MockTableDropper) DropTable(name string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DropTable", name) @@ -77,8 +107,32 @@ func (m *MockTableDropper) DropTable(name string) error { return ret0 } -// DropTable indicates an expected call of DropTable -func (mr *MockTableDropperMockRecorder) DropTable(name interface{}) *gomock.Call { +// DropTable indicates an expected call of DropTable. +func (mr *MockTableDropperMockRecorder) DropTable(name any) *MockTableDropperDropTableCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropTable", reflect.TypeOf((*MockTableDropper)(nil).DropTable), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropTable", reflect.TypeOf((*MockTableDropper)(nil).DropTable), name) + return &MockTableDropperDropTableCall{Call: call} +} + +// MockTableDropperDropTableCall wrap *gomock.Call +type MockTableDropperDropTableCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableDropperDropTableCall) Return(arg0 error) *MockTableDropperDropTableCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableDropperDropTableCall) Do(f func(string) error) *MockTableDropperDropTableCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableDropperDropTableCall) DoAndReturn(f func(string) error) *MockTableDropperDropTableCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/planning/plan/drop_test.go b/internal/sql/planning/plan/drop_test.go index 4b94715..e2c59e1 100644 --- a/internal/sql/planning/plan/drop_test.go +++ b/internal/sql/planning/plan/drop_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql/planning/plan" ) diff --git a/internal/sql/planning/plan/filter_test.go b/internal/sql/planning/plan/filter_test.go index 17e1d64..cbe807a 100644 --- a/internal/sql/planning/plan/filter_test.go +++ b/internal/sql/planning/plan/filter_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/insert.go b/internal/sql/planning/plan/insert.go index 05a2019..9928424 100644 --- a/internal/sql/planning/plan/insert.go +++ b/internal/sql/planning/plan/insert.go @@ -6,7 +6,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql" ) -//go:generate mockgen -source=insert.go -destination ./insert_mock_test.go -package plan_test +//go:generate go run go.uber.org/mock/mockgen -typed -source=insert.go -destination ./insert_mock_test.go -package plan_test type TableInserter interface { Insert(key int64, row sql.Row) error diff --git a/internal/sql/planning/plan/insert_mock_test.go b/internal/sql/planning/plan/insert_mock_test.go index 1d4eb1c..b4972f5 100644 --- a/internal/sql/planning/plan/insert_mock_test.go +++ b/internal/sql/planning/plan/insert_mock_test.go @@ -1,39 +1,45 @@ // Code generated by MockGen. DO NOT EDIT. // Source: insert.go +// +// Generated by this command: +// +// mockgen -typed -source=insert.go -destination ./insert_mock_test.go -package plan_test +// // Package plan_test is a generated GoMock package. package plan_test import ( - gomock "github.com/golang/mock/gomock" - sql "github.com/i-sevostyanov/NanoDB/internal/sql" reflect "reflect" + + sql "github.com/i-sevostyanov/NanoDB/internal/sql" + gomock "go.uber.org/mock/gomock" ) -// MockTableInserter is a mock of TableInserter interface +// MockTableInserter is a mock of TableInserter interface. type MockTableInserter struct { ctrl *gomock.Controller recorder *MockTableInserterMockRecorder } -// MockTableInserterMockRecorder is the mock recorder for MockTableInserter +// MockTableInserterMockRecorder is the mock recorder for MockTableInserter. type MockTableInserterMockRecorder struct { mock *MockTableInserter } -// NewMockTableInserter creates a new mock instance +// NewMockTableInserter creates a new mock instance. func NewMockTableInserter(ctrl *gomock.Controller) *MockTableInserter { mock := &MockTableInserter{ctrl: ctrl} mock.recorder = &MockTableInserterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockTableInserter) EXPECT() *MockTableInserterMockRecorder { return m.recorder } -// Insert mocks base method +// Insert mocks base method. func (m *MockTableInserter) Insert(key int64, row sql.Row) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Insert", key, row) @@ -41,8 +47,32 @@ func (m *MockTableInserter) Insert(key int64, row sql.Row) error { return ret0 } -// Insert indicates an expected call of Insert -func (mr *MockTableInserterMockRecorder) Insert(key, row interface{}) *gomock.Call { +// Insert indicates an expected call of Insert. +func (mr *MockTableInserterMockRecorder) Insert(key, row any) *MockTableInserterInsertCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockTableInserter)(nil).Insert), key, row) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockTableInserter)(nil).Insert), key, row) + return &MockTableInserterInsertCall{Call: call} +} + +// MockTableInserterInsertCall wrap *gomock.Call +type MockTableInserterInsertCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableInserterInsertCall) Return(arg0 error) *MockTableInserterInsertCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableInserterInsertCall) Do(f func(int64, sql.Row) error) *MockTableInserterInsertCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableInserterInsertCall) DoAndReturn(f func(int64, sql.Row) error) *MockTableInserterInsertCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/planning/plan/insert_test.go b/internal/sql/planning/plan/insert_test.go index 2e61f2e..50f22a9 100644 --- a/internal/sql/planning/plan/insert_test.go +++ b/internal/sql/planning/plan/insert_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/limit_test.go b/internal/sql/planning/plan/limit_test.go index b43f824..cc18d57 100644 --- a/internal/sql/planning/plan/limit_test.go +++ b/internal/sql/planning/plan/limit_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/offset_test.go b/internal/sql/planning/plan/offset_test.go index aa1423d..8a13d13 100644 --- a/internal/sql/planning/plan/offset_test.go +++ b/internal/sql/planning/plan/offset_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/plan.go b/internal/sql/planning/plan/plan.go index a4a76d1..21fdaf7 100644 --- a/internal/sql/planning/plan/plan.go +++ b/internal/sql/planning/plan/plan.go @@ -4,7 +4,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql" ) -//go:generate mockgen -source=plan.go -destination ./plan_mock.go -package plan +//go:generate go run go.uber.org/mock/mockgen -typed -source=plan.go -destination ./plan_mock.go -package plan type Node interface { Columns() []string diff --git a/internal/sql/planning/plan/plan_mock.go b/internal/sql/planning/plan/plan_mock.go index 733ddfd..48caa4b 100644 --- a/internal/sql/planning/plan/plan_mock.go +++ b/internal/sql/planning/plan/plan_mock.go @@ -1,39 +1,45 @@ // Code generated by MockGen. DO NOT EDIT. // Source: plan.go +// +// Generated by this command: +// +// mockgen -typed -source=plan.go -destination ./plan_mock.go -package plan +// // Package plan is a generated GoMock package. package plan import ( - gomock "github.com/golang/mock/gomock" - sql "github.com/i-sevostyanov/NanoDB/internal/sql" reflect "reflect" + + sql "github.com/i-sevostyanov/NanoDB/internal/sql" + gomock "go.uber.org/mock/gomock" ) -// MockNode is a mock of Node interface +// MockNode is a mock of Node interface. type MockNode struct { ctrl *gomock.Controller recorder *MockNodeMockRecorder } -// MockNodeMockRecorder is the mock recorder for MockNode +// MockNodeMockRecorder is the mock recorder for MockNode. type MockNodeMockRecorder struct { mock *MockNode } -// NewMockNode creates a new mock instance +// NewMockNode creates a new mock instance. func NewMockNode(ctrl *gomock.Controller) *MockNode { mock := &MockNode{ctrl: ctrl} mock.recorder = &MockNodeMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockNode) EXPECT() *MockNodeMockRecorder { return m.recorder } -// Columns mocks base method +// Columns mocks base method. func (m *MockNode) Columns() []string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Columns") @@ -41,13 +47,37 @@ func (m *MockNode) Columns() []string { return ret0 } -// Columns indicates an expected call of Columns -func (mr *MockNodeMockRecorder) Columns() *gomock.Call { +// Columns indicates an expected call of Columns. +func (mr *MockNodeMockRecorder) Columns() *MockNodeColumnsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Columns", reflect.TypeOf((*MockNode)(nil).Columns)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Columns", reflect.TypeOf((*MockNode)(nil).Columns)) + return &MockNodeColumnsCall{Call: call} +} + +// MockNodeColumnsCall wrap *gomock.Call +type MockNodeColumnsCall struct { + *gomock.Call } -// RowIter mocks base method +// Return rewrite *gomock.Call.Return +func (c *MockNodeColumnsCall) Return(arg0 []string) *MockNodeColumnsCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockNodeColumnsCall) Do(f func() []string) *MockNodeColumnsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockNodeColumnsCall) DoAndReturn(f func() []string) *MockNodeColumnsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RowIter mocks base method. func (m *MockNode) RowIter() (sql.RowIter, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RowIter") @@ -56,8 +86,32 @@ func (m *MockNode) RowIter() (sql.RowIter, error) { return ret0, ret1 } -// RowIter indicates an expected call of RowIter -func (mr *MockNodeMockRecorder) RowIter() *gomock.Call { +// RowIter indicates an expected call of RowIter. +func (mr *MockNodeMockRecorder) RowIter() *MockNodeRowIterCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RowIter", reflect.TypeOf((*MockNode)(nil).RowIter)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RowIter", reflect.TypeOf((*MockNode)(nil).RowIter)) + return &MockNodeRowIterCall{Call: call} +} + +// MockNodeRowIterCall wrap *gomock.Call +type MockNodeRowIterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockNodeRowIterCall) Return(arg0 sql.RowIter, arg1 error) *MockNodeRowIterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockNodeRowIterCall) Do(f func() (sql.RowIter, error)) *MockNodeRowIterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockNodeRowIterCall) DoAndReturn(f func() (sql.RowIter, error)) *MockNodeRowIterCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/planning/plan/project_test.go b/internal/sql/planning/plan/project_test.go index 4526153..8e07af7 100644 --- a/internal/sql/planning/plan/project_test.go +++ b/internal/sql/planning/plan/project_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/scan_test.go b/internal/sql/planning/plan/scan_test.go index e77a69a..f719199 100644 --- a/internal/sql/planning/plan/scan_test.go +++ b/internal/sql/planning/plan/scan_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/planning/plan" diff --git a/internal/sql/planning/plan/sort_test.go b/internal/sql/planning/plan/sort_test.go index 936ecbf..1aa8bff 100644 --- a/internal/sql/planning/plan/sort_test.go +++ b/internal/sql/planning/plan/sort_test.go @@ -6,9 +6,9 @@ import ( "math" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/plan/update.go b/internal/sql/planning/plan/update.go index 0a4310f..4f3c7e8 100644 --- a/internal/sql/planning/plan/update.go +++ b/internal/sql/planning/plan/update.go @@ -9,7 +9,7 @@ import ( "github.com/i-sevostyanov/NanoDB/internal/sql/expr" ) -//go:generate mockgen -source=update.go -destination ./update_mock_test.go -package plan_test +//go:generate go run go.uber.org/mock/mockgen -typed -source=update.go -destination ./update_mock_test.go -package plan_test type RowUpdater interface { Update(key int64, row sql.Row) error diff --git a/internal/sql/planning/plan/update_mock_test.go b/internal/sql/planning/plan/update_mock_test.go index b7f2463..912fddd 100644 --- a/internal/sql/planning/plan/update_mock_test.go +++ b/internal/sql/planning/plan/update_mock_test.go @@ -1,39 +1,45 @@ // Code generated by MockGen. DO NOT EDIT. // Source: update.go +// +// Generated by this command: +// +// mockgen -typed -source=update.go -destination ./update_mock_test.go -package plan_test +// // Package plan_test is a generated GoMock package. package plan_test import ( - gomock "github.com/golang/mock/gomock" - sql "github.com/i-sevostyanov/NanoDB/internal/sql" reflect "reflect" + + sql "github.com/i-sevostyanov/NanoDB/internal/sql" + gomock "go.uber.org/mock/gomock" ) -// MockRowUpdater is a mock of RowUpdater interface +// MockRowUpdater is a mock of RowUpdater interface. type MockRowUpdater struct { ctrl *gomock.Controller recorder *MockRowUpdaterMockRecorder } -// MockRowUpdaterMockRecorder is the mock recorder for MockRowUpdater +// MockRowUpdaterMockRecorder is the mock recorder for MockRowUpdater. type MockRowUpdaterMockRecorder struct { mock *MockRowUpdater } -// NewMockRowUpdater creates a new mock instance +// NewMockRowUpdater creates a new mock instance. func NewMockRowUpdater(ctrl *gomock.Controller) *MockRowUpdater { mock := &MockRowUpdater{ctrl: ctrl} mock.recorder = &MockRowUpdaterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRowUpdater) EXPECT() *MockRowUpdaterMockRecorder { return m.recorder } -// Update mocks base method +// Update mocks base method. func (m *MockRowUpdater) Update(key int64, row sql.Row) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Update", key, row) @@ -41,8 +47,32 @@ func (m *MockRowUpdater) Update(key int64, row sql.Row) error { return ret0 } -// Update indicates an expected call of Update -func (mr *MockRowUpdaterMockRecorder) Update(key, row interface{}) *gomock.Call { +// Update indicates an expected call of Update. +func (mr *MockRowUpdaterMockRecorder) Update(key, row any) *MockRowUpdaterUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockRowUpdater)(nil).Update), key, row) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockRowUpdater)(nil).Update), key, row) + return &MockRowUpdaterUpdateCall{Call: call} +} + +// MockRowUpdaterUpdateCall wrap *gomock.Call +type MockRowUpdaterUpdateCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockRowUpdaterUpdateCall) Return(arg0 error) *MockRowUpdaterUpdateCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockRowUpdaterUpdateCall) Do(f func(int64, sql.Row) error) *MockRowUpdaterUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockRowUpdaterUpdateCall) DoAndReturn(f func(int64, sql.Row) error) *MockRowUpdaterUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/planning/plan/update_test.go b/internal/sql/planning/plan/update_test.go index d06dfb1..54eaa53 100644 --- a/internal/sql/planning/plan/update_test.go +++ b/internal/sql/planning/plan/update_test.go @@ -5,9 +5,9 @@ import ( "io" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/planning/planner/planner_test.go b/internal/sql/planning/planner/planner_test.go index 23e9ffa..3dec142 100644 --- a/internal/sql/planning/planner/planner_test.go +++ b/internal/sql/planning/planner/planner_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" "github.com/i-sevostyanov/NanoDB/internal/sql" "github.com/i-sevostyanov/NanoDB/internal/sql/datatype" diff --git a/internal/sql/rows.go b/internal/sql/rows.go index 28ae0c4..8382fd9 100644 --- a/internal/sql/rows.go +++ b/internal/sql/rows.go @@ -4,7 +4,7 @@ import ( "io" ) -//go:generate mockgen -source=rows.go -destination ./rows_mock.go -package sql +//go:generate go run go.uber.org/mock/mockgen -typed -source=rows.go -destination ./rows_mock.go -package sql type Row []Value diff --git a/internal/sql/rows_mock.go b/internal/sql/rows_mock.go index 49c102c..dcc0054 100644 --- a/internal/sql/rows_mock.go +++ b/internal/sql/rows_mock.go @@ -1,38 +1,82 @@ // Code generated by MockGen. DO NOT EDIT. // Source: rows.go +// +// Generated by this command: +// +// mockgen -typed -source=rows.go -destination ./rows_mock.go -package sql +// // Package sql is a generated GoMock package. package sql import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "go.uber.org/mock/gomock" ) -// MockRowIter is a mock of RowIter interface +// MockRowIter is a mock of RowIter interface. type MockRowIter struct { ctrl *gomock.Controller recorder *MockRowIterMockRecorder } -// MockRowIterMockRecorder is the mock recorder for MockRowIter +// MockRowIterMockRecorder is the mock recorder for MockRowIter. type MockRowIterMockRecorder struct { mock *MockRowIter } -// NewMockRowIter creates a new mock instance +// NewMockRowIter creates a new mock instance. func NewMockRowIter(ctrl *gomock.Controller) *MockRowIter { mock := &MockRowIter{ctrl: ctrl} mock.recorder = &MockRowIterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRowIter) EXPECT() *MockRowIterMockRecorder { return m.recorder } -// Next mocks base method +// Close mocks base method. +func (m *MockRowIter) Close() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close") + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close. +func (mr *MockRowIterMockRecorder) Close() *MockRowIterCloseCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockRowIter)(nil).Close)) + return &MockRowIterCloseCall{Call: call} +} + +// MockRowIterCloseCall wrap *gomock.Call +type MockRowIterCloseCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockRowIterCloseCall) Return(arg0 error) *MockRowIterCloseCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockRowIterCloseCall) Do(f func() error) *MockRowIterCloseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockRowIterCloseCall) DoAndReturn(f func() error) *MockRowIterCloseCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Next mocks base method. func (m *MockRowIter) Next() (Row, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Next") @@ -41,22 +85,32 @@ func (m *MockRowIter) Next() (Row, error) { return ret0, ret1 } -// Next indicates an expected call of Next -func (mr *MockRowIterMockRecorder) Next() *gomock.Call { +// Next indicates an expected call of Next. +func (mr *MockRowIterMockRecorder) Next() *MockRowIterNextCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*MockRowIter)(nil).Next)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*MockRowIter)(nil).Next)) + return &MockRowIterNextCall{Call: call} } -// Close mocks base method -func (m *MockRowIter) Close() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close") - ret0, _ := ret[0].(error) - return ret0 +// MockRowIterNextCall wrap *gomock.Call +type MockRowIterNextCall struct { + *gomock.Call } -// Close indicates an expected call of Close -func (mr *MockRowIterMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockRowIter)(nil).Close)) +// Return rewrite *gomock.Call.Return +func (c *MockRowIterNextCall) Return(arg0 Row, arg1 error) *MockRowIterNextCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockRowIterNextCall) Do(f func() (Row, error)) *MockRowIterNextCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockRowIterNextCall) DoAndReturn(f func() (Row, error)) *MockRowIterNextCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/type.go b/internal/sql/type.go index 9a469b0..1e1c2b6 100644 --- a/internal/sql/type.go +++ b/internal/sql/type.go @@ -1,6 +1,6 @@ package sql -//go:generate mockgen -source=type.go -destination ./type_mock.go -package sql +//go:generate go run go.uber.org/mock/mockgen -typed -source=type.go -destination ./type_mock.go -package sql // Catalog holds meta-information about databases. type Catalog interface { diff --git a/internal/sql/type_mock.go b/internal/sql/type_mock.go index 039f433..891fd0f 100644 --- a/internal/sql/type_mock.go +++ b/internal/sql/type_mock.go @@ -1,134 +1,299 @@ // Code generated by MockGen. DO NOT EDIT. // Source: type.go +// +// Generated by this command: +// +// mockgen -typed -source=type.go -destination ./type_mock.go -package sql +// // Package sql is a generated GoMock package. package sql import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "go.uber.org/mock/gomock" ) -// MockCatalog is a mock of Catalog interface +// MockCatalog is a mock of Catalog interface. type MockCatalog struct { ctrl *gomock.Controller recorder *MockCatalogMockRecorder } -// MockCatalogMockRecorder is the mock recorder for MockCatalog +// MockCatalogMockRecorder is the mock recorder for MockCatalog. type MockCatalogMockRecorder struct { mock *MockCatalog } -// NewMockCatalog creates a new mock instance +// NewMockCatalog creates a new mock instance. func NewMockCatalog(ctrl *gomock.Controller) *MockCatalog { mock := &MockCatalog{ctrl: ctrl} mock.recorder = &MockCatalogMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockCatalog) EXPECT() *MockCatalogMockRecorder { return m.recorder } -// GetDatabase mocks base method -func (m *MockCatalog) GetDatabase(name string) (Database, error) { +// CreateDatabase mocks base method. +func (m *MockCatalog) CreateDatabase(name string) (Database, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDatabase", name) + ret := m.ctrl.Call(m, "CreateDatabase", name) ret0, _ := ret[0].(Database) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetDatabase indicates an expected call of GetDatabase -func (mr *MockCatalogMockRecorder) GetDatabase(name interface{}) *gomock.Call { +// CreateDatabase indicates an expected call of CreateDatabase. +func (mr *MockCatalogMockRecorder) CreateDatabase(name any) *MockCatalogCreateDatabaseCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDatabase", reflect.TypeOf((*MockCatalog)(nil).GetDatabase), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDatabase", reflect.TypeOf((*MockCatalog)(nil).CreateDatabase), name) + return &MockCatalogCreateDatabaseCall{Call: call} } -// ListDatabases mocks base method -func (m *MockCatalog) ListDatabases() ([]Database, error) { +// MockCatalogCreateDatabaseCall wrap *gomock.Call +type MockCatalogCreateDatabaseCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockCatalogCreateDatabaseCall) Return(arg0 Database, arg1 error) *MockCatalogCreateDatabaseCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockCatalogCreateDatabaseCall) Do(f func(string) (Database, error)) *MockCatalogCreateDatabaseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockCatalogCreateDatabaseCall) DoAndReturn(f func(string) (Database, error)) *MockCatalogCreateDatabaseCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// DropDatabase mocks base method. +func (m *MockCatalog) DropDatabase(name string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ListDatabases") - ret0, _ := ret[0].([]Database) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "DropDatabase", name) + ret0, _ := ret[0].(error) + return ret0 } -// ListDatabases indicates an expected call of ListDatabases -func (mr *MockCatalogMockRecorder) ListDatabases() *gomock.Call { +// DropDatabase indicates an expected call of DropDatabase. +func (mr *MockCatalogMockRecorder) DropDatabase(name any) *MockCatalogDropDatabaseCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListDatabases", reflect.TypeOf((*MockCatalog)(nil).ListDatabases)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropDatabase", reflect.TypeOf((*MockCatalog)(nil).DropDatabase), name) + return &MockCatalogDropDatabaseCall{Call: call} } -// CreateDatabase mocks base method -func (m *MockCatalog) CreateDatabase(name string) (Database, error) { +// MockCatalogDropDatabaseCall wrap *gomock.Call +type MockCatalogDropDatabaseCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockCatalogDropDatabaseCall) Return(arg0 error) *MockCatalogDropDatabaseCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockCatalogDropDatabaseCall) Do(f func(string) error) *MockCatalogDropDatabaseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockCatalogDropDatabaseCall) DoAndReturn(f func(string) error) *MockCatalogDropDatabaseCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetDatabase mocks base method. +func (m *MockCatalog) GetDatabase(name string) (Database, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateDatabase", name) + ret := m.ctrl.Call(m, "GetDatabase", name) ret0, _ := ret[0].(Database) ret1, _ := ret[1].(error) return ret0, ret1 } -// CreateDatabase indicates an expected call of CreateDatabase -func (mr *MockCatalogMockRecorder) CreateDatabase(name interface{}) *gomock.Call { +// GetDatabase indicates an expected call of GetDatabase. +func (mr *MockCatalogMockRecorder) GetDatabase(name any) *MockCatalogGetDatabaseCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateDatabase", reflect.TypeOf((*MockCatalog)(nil).CreateDatabase), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDatabase", reflect.TypeOf((*MockCatalog)(nil).GetDatabase), name) + return &MockCatalogGetDatabaseCall{Call: call} } -// DropDatabase mocks base method -func (m *MockCatalog) DropDatabase(name string) error { +// MockCatalogGetDatabaseCall wrap *gomock.Call +type MockCatalogGetDatabaseCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockCatalogGetDatabaseCall) Return(arg0 Database, arg1 error) *MockCatalogGetDatabaseCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockCatalogGetDatabaseCall) Do(f func(string) (Database, error)) *MockCatalogGetDatabaseCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockCatalogGetDatabaseCall) DoAndReturn(f func(string) (Database, error)) *MockCatalogGetDatabaseCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListDatabases mocks base method. +func (m *MockCatalog) ListDatabases() ([]Database, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DropDatabase", name) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "ListDatabases") + ret0, _ := ret[0].([]Database) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// DropDatabase indicates an expected call of DropDatabase -func (mr *MockCatalogMockRecorder) DropDatabase(name interface{}) *gomock.Call { +// ListDatabases indicates an expected call of ListDatabases. +func (mr *MockCatalogMockRecorder) ListDatabases() *MockCatalogListDatabasesCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropDatabase", reflect.TypeOf((*MockCatalog)(nil).DropDatabase), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListDatabases", reflect.TypeOf((*MockCatalog)(nil).ListDatabases)) + return &MockCatalogListDatabasesCall{Call: call} +} + +// MockCatalogListDatabasesCall wrap *gomock.Call +type MockCatalogListDatabasesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockCatalogListDatabasesCall) Return(arg0 []Database, arg1 error) *MockCatalogListDatabasesCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockCatalogListDatabasesCall) Do(f func() ([]Database, error)) *MockCatalogListDatabasesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockCatalogListDatabasesCall) DoAndReturn(f func() ([]Database, error)) *MockCatalogListDatabasesCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// MockDatabase is a mock of Database interface +// MockDatabase is a mock of Database interface. type MockDatabase struct { ctrl *gomock.Controller recorder *MockDatabaseMockRecorder } -// MockDatabaseMockRecorder is the mock recorder for MockDatabase +// MockDatabaseMockRecorder is the mock recorder for MockDatabase. type MockDatabaseMockRecorder struct { mock *MockDatabase } -// NewMockDatabase creates a new mock instance +// NewMockDatabase creates a new mock instance. func NewMockDatabase(ctrl *gomock.Controller) *MockDatabase { mock := &MockDatabase{ctrl: ctrl} mock.recorder = &MockDatabaseMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockDatabase) EXPECT() *MockDatabaseMockRecorder { return m.recorder } -// Name mocks base method -func (m *MockDatabase) Name() string { +// CreateTable mocks base method. +func (m *MockDatabase) CreateTable(name string, scheme Scheme) (Table, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Name") - ret0, _ := ret[0].(string) + ret := m.ctrl.Call(m, "CreateTable", name, scheme) + ret0, _ := ret[0].(Table) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateTable indicates an expected call of CreateTable. +func (mr *MockDatabaseMockRecorder) CreateTable(name, scheme any) *MockDatabaseCreateTableCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTable", reflect.TypeOf((*MockDatabase)(nil).CreateTable), name, scheme) + return &MockDatabaseCreateTableCall{Call: call} +} + +// MockDatabaseCreateTableCall wrap *gomock.Call +type MockDatabaseCreateTableCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseCreateTableCall) Return(arg0 Table, arg1 error) *MockDatabaseCreateTableCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseCreateTableCall) Do(f func(string, Scheme) (Table, error)) *MockDatabaseCreateTableCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseCreateTableCall) DoAndReturn(f func(string, Scheme) (Table, error)) *MockDatabaseCreateTableCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// DropTable mocks base method. +func (m *MockDatabase) DropTable(name string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DropTable", name) + ret0, _ := ret[0].(error) return ret0 } -// Name indicates an expected call of Name -func (mr *MockDatabaseMockRecorder) Name() *gomock.Call { +// DropTable indicates an expected call of DropTable. +func (mr *MockDatabaseMockRecorder) DropTable(name any) *MockDatabaseDropTableCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockDatabase)(nil).Name)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropTable", reflect.TypeOf((*MockDatabase)(nil).DropTable), name) + return &MockDatabaseDropTableCall{Call: call} +} + +// MockDatabaseDropTableCall wrap *gomock.Call +type MockDatabaseDropTableCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseDropTableCall) Return(arg0 error) *MockDatabaseDropTableCall { + c.Call = c.Call.Return(arg0) + return c } -// GetTable mocks base method +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseDropTableCall) Do(f func(string) error) *MockDatabaseDropTableCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseDropTableCall) DoAndReturn(f func(string) error) *MockDatabaseDropTableCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetTable mocks base method. func (m *MockDatabase) GetTable(name string) (Table, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTable", name) @@ -137,13 +302,37 @@ func (m *MockDatabase) GetTable(name string) (Table, error) { return ret0, ret1 } -// GetTable indicates an expected call of GetTable -func (mr *MockDatabaseMockRecorder) GetTable(name interface{}) *gomock.Call { +// GetTable indicates an expected call of GetTable. +func (mr *MockDatabaseMockRecorder) GetTable(name any) *MockDatabaseGetTableCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTable", reflect.TypeOf((*MockDatabase)(nil).GetTable), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTable", reflect.TypeOf((*MockDatabase)(nil).GetTable), name) + return &MockDatabaseGetTableCall{Call: call} +} + +// MockDatabaseGetTableCall wrap *gomock.Call +type MockDatabaseGetTableCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseGetTableCall) Return(arg0 Table, arg1 error) *MockDatabaseGetTableCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// ListTables mocks base method +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseGetTableCall) Do(f func(string) (Table, error)) *MockDatabaseGetTableCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseGetTableCall) DoAndReturn(f func(string) (Table, error)) *MockDatabaseGetTableCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListTables mocks base method. func (m *MockDatabase) ListTables() []Table { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListTables") @@ -151,121 +340,250 @@ func (m *MockDatabase) ListTables() []Table { return ret0 } -// ListTables indicates an expected call of ListTables -func (mr *MockDatabaseMockRecorder) ListTables() *gomock.Call { +// ListTables indicates an expected call of ListTables. +func (mr *MockDatabaseMockRecorder) ListTables() *MockDatabaseListTablesCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTables", reflect.TypeOf((*MockDatabase)(nil).ListTables)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTables", reflect.TypeOf((*MockDatabase)(nil).ListTables)) + return &MockDatabaseListTablesCall{Call: call} } -// CreateTable mocks base method -func (m *MockDatabase) CreateTable(name string, scheme Scheme) (Table, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateTable", name, scheme) - ret0, _ := ret[0].(Table) - ret1, _ := ret[1].(error) - return ret0, ret1 +// MockDatabaseListTablesCall wrap *gomock.Call +type MockDatabaseListTablesCall struct { + *gomock.Call } -// CreateTable indicates an expected call of CreateTable -func (mr *MockDatabaseMockRecorder) CreateTable(name, scheme interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTable", reflect.TypeOf((*MockDatabase)(nil).CreateTable), name, scheme) +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseListTablesCall) Return(arg0 []Table) *MockDatabaseListTablesCall { + c.Call = c.Call.Return(arg0) + return c } -// DropTable mocks base method -func (m *MockDatabase) DropTable(name string) error { +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseListTablesCall) Do(f func() []Table) *MockDatabaseListTablesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseListTablesCall) DoAndReturn(f func() []Table) *MockDatabaseListTablesCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Name mocks base method. +func (m *MockDatabase) Name() string { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DropTable", name) - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) return ret0 } -// DropTable indicates an expected call of DropTable -func (mr *MockDatabaseMockRecorder) DropTable(name interface{}) *gomock.Call { +// Name indicates an expected call of Name. +func (mr *MockDatabaseMockRecorder) Name() *MockDatabaseNameCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropTable", reflect.TypeOf((*MockDatabase)(nil).DropTable), name) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockDatabase)(nil).Name)) + return &MockDatabaseNameCall{Call: call} } -// MockTable is a mock of Table interface +// MockDatabaseNameCall wrap *gomock.Call +type MockDatabaseNameCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockDatabaseNameCall) Return(arg0 string) *MockDatabaseNameCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockDatabaseNameCall) Do(f func() string) *MockDatabaseNameCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockDatabaseNameCall) DoAndReturn(f func() string) *MockDatabaseNameCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MockTable is a mock of Table interface. type MockTable struct { ctrl *gomock.Controller recorder *MockTableMockRecorder } -// MockTableMockRecorder is the mock recorder for MockTable +// MockTableMockRecorder is the mock recorder for MockTable. type MockTableMockRecorder struct { mock *MockTable } -// NewMockTable creates a new mock instance +// NewMockTable creates a new mock instance. func NewMockTable(ctrl *gomock.Controller) *MockTable { mock := &MockTable{ctrl: ctrl} mock.recorder = &MockTableMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockTable) EXPECT() *MockTableMockRecorder { return m.recorder } -// Name mocks base method -func (m *MockTable) Name() string { +// Delete mocks base method. +func (m *MockTable) Delete(key int64) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Name") - ret0, _ := ret[0].(string) + ret := m.ctrl.Call(m, "Delete", key) + ret0, _ := ret[0].(error) return ret0 } -// Name indicates an expected call of Name -func (mr *MockTableMockRecorder) Name() *gomock.Call { +// Delete indicates an expected call of Delete. +func (mr *MockTableMockRecorder) Delete(key any) *MockTableDeleteCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockTable)(nil).Name)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockTable)(nil).Delete), key) + return &MockTableDeleteCall{Call: call} } -// Scheme mocks base method -func (m *MockTable) Scheme() Scheme { +// MockTableDeleteCall wrap *gomock.Call +type MockTableDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableDeleteCall) Return(arg0 error) *MockTableDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableDeleteCall) Do(f func(int64) error) *MockTableDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableDeleteCall) DoAndReturn(f func(int64) error) *MockTableDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Insert mocks base method. +func (m *MockTable) Insert(key int64, row Row) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Scheme") - ret0, _ := ret[0].(Scheme) + ret := m.ctrl.Call(m, "Insert", key, row) + ret0, _ := ret[0].(error) return ret0 } -// Scheme indicates an expected call of Scheme -func (mr *MockTableMockRecorder) Scheme() *gomock.Call { +// Insert indicates an expected call of Insert. +func (mr *MockTableMockRecorder) Insert(key, row any) *MockTableInsertCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scheme", reflect.TypeOf((*MockTable)(nil).Scheme)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockTable)(nil).Insert), key, row) + return &MockTableInsertCall{Call: call} } -// PrimaryKey mocks base method -func (m *MockTable) PrimaryKey() Column { +// MockTableInsertCall wrap *gomock.Call +type MockTableInsertCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableInsertCall) Return(arg0 error) *MockTableInsertCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableInsertCall) Do(f func(int64, Row) error) *MockTableInsertCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableInsertCall) DoAndReturn(f func(int64, Row) error) *MockTableInsertCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Name mocks base method. +func (m *MockTable) Name() string { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PrimaryKey") - ret0, _ := ret[0].(Column) + ret := m.ctrl.Call(m, "Name") + ret0, _ := ret[0].(string) return ret0 } -// PrimaryKey indicates an expected call of PrimaryKey -func (mr *MockTableMockRecorder) PrimaryKey() *gomock.Call { +// Name indicates an expected call of Name. +func (mr *MockTableMockRecorder) Name() *MockTableNameCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrimaryKey", reflect.TypeOf((*MockTable)(nil).PrimaryKey)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockTable)(nil).Name)) + return &MockTableNameCall{Call: call} } -// Sequence mocks base method -func (m *MockTable) Sequence() Sequence { +// MockTableNameCall wrap *gomock.Call +type MockTableNameCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableNameCall) Return(arg0 string) *MockTableNameCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableNameCall) Do(f func() string) *MockTableNameCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableNameCall) DoAndReturn(f func() string) *MockTableNameCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// PrimaryKey mocks base method. +func (m *MockTable) PrimaryKey() Column { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Sequence") - ret0, _ := ret[0].(Sequence) + ret := m.ctrl.Call(m, "PrimaryKey") + ret0, _ := ret[0].(Column) return ret0 } -// Sequence indicates an expected call of Sequence -func (mr *MockTableMockRecorder) Sequence() *gomock.Call { +// PrimaryKey indicates an expected call of PrimaryKey. +func (mr *MockTableMockRecorder) PrimaryKey() *MockTablePrimaryKeyCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sequence", reflect.TypeOf((*MockTable)(nil).Sequence)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PrimaryKey", reflect.TypeOf((*MockTable)(nil).PrimaryKey)) + return &MockTablePrimaryKeyCall{Call: call} +} + +// MockTablePrimaryKeyCall wrap *gomock.Call +type MockTablePrimaryKeyCall struct { + *gomock.Call } -// Scan mocks base method +// Return rewrite *gomock.Call.Return +func (c *MockTablePrimaryKeyCall) Return(arg0 Column) *MockTablePrimaryKeyCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTablePrimaryKeyCall) Do(f func() Column) *MockTablePrimaryKeyCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTablePrimaryKeyCall) DoAndReturn(f func() Column) *MockTablePrimaryKeyCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Scan mocks base method. func (m *MockTable) Scan() (RowIter, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Scan") @@ -274,41 +592,113 @@ func (m *MockTable) Scan() (RowIter, error) { return ret0, ret1 } -// Scan indicates an expected call of Scan -func (mr *MockTableMockRecorder) Scan() *gomock.Call { +// Scan indicates an expected call of Scan. +func (mr *MockTableMockRecorder) Scan() *MockTableScanCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockTable)(nil).Scan)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scan", reflect.TypeOf((*MockTable)(nil).Scan)) + return &MockTableScanCall{Call: call} } -// Insert mocks base method -func (m *MockTable) Insert(key int64, row Row) error { +// MockTableScanCall wrap *gomock.Call +type MockTableScanCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableScanCall) Return(arg0 RowIter, arg1 error) *MockTableScanCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableScanCall) Do(f func() (RowIter, error)) *MockTableScanCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableScanCall) DoAndReturn(f func() (RowIter, error)) *MockTableScanCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Scheme mocks base method. +func (m *MockTable) Scheme() Scheme { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Insert", key, row) - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "Scheme") + ret0, _ := ret[0].(Scheme) return ret0 } -// Insert indicates an expected call of Insert -func (mr *MockTableMockRecorder) Insert(key, row interface{}) *gomock.Call { +// Scheme indicates an expected call of Scheme. +func (mr *MockTableMockRecorder) Scheme() *MockTableSchemeCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Insert", reflect.TypeOf((*MockTable)(nil).Insert), key, row) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Scheme", reflect.TypeOf((*MockTable)(nil).Scheme)) + return &MockTableSchemeCall{Call: call} } -// Delete mocks base method -func (m *MockTable) Delete(key int64) error { +// MockTableSchemeCall wrap *gomock.Call +type MockTableSchemeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockTableSchemeCall) Return(arg0 Scheme) *MockTableSchemeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableSchemeCall) Do(f func() Scheme) *MockTableSchemeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableSchemeCall) DoAndReturn(f func() Scheme) *MockTableSchemeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Sequence mocks base method. +func (m *MockTable) Sequence() Sequence { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delete", key) - ret0, _ := ret[0].(error) + ret := m.ctrl.Call(m, "Sequence") + ret0, _ := ret[0].(Sequence) return ret0 } -// Delete indicates an expected call of Delete -func (mr *MockTableMockRecorder) Delete(key interface{}) *gomock.Call { +// Sequence indicates an expected call of Sequence. +func (mr *MockTableMockRecorder) Sequence() *MockTableSequenceCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockTable)(nil).Delete), key) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sequence", reflect.TypeOf((*MockTable)(nil).Sequence)) + return &MockTableSequenceCall{Call: call} +} + +// MockTableSequenceCall wrap *gomock.Call +type MockTableSequenceCall struct { + *gomock.Call } -// Update mocks base method +// Return rewrite *gomock.Call.Return +func (c *MockTableSequenceCall) Return(arg0 Sequence) *MockTableSequenceCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableSequenceCall) Do(f func() Sequence) *MockTableSequenceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableSequenceCall) DoAndReturn(f func() Sequence) *MockTableSequenceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Update mocks base method. func (m *MockTable) Update(key int64, row Row) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Update", key, row) @@ -316,36 +706,60 @@ func (m *MockTable) Update(key int64, row Row) error { return ret0 } -// Update indicates an expected call of Update -func (mr *MockTableMockRecorder) Update(key, row interface{}) *gomock.Call { +// Update indicates an expected call of Update. +func (mr *MockTableMockRecorder) Update(key, row any) *MockTableUpdateCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockTable)(nil).Update), key, row) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockTable)(nil).Update), key, row) + return &MockTableUpdateCall{Call: call} +} + +// MockTableUpdateCall wrap *gomock.Call +type MockTableUpdateCall struct { + *gomock.Call } -// MockSequence is a mock of Sequence interface +// Return rewrite *gomock.Call.Return +func (c *MockTableUpdateCall) Return(arg0 error) *MockTableUpdateCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockTableUpdateCall) Do(f func(int64, Row) error) *MockTableUpdateCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockTableUpdateCall) DoAndReturn(f func(int64, Row) error) *MockTableUpdateCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MockSequence is a mock of Sequence interface. type MockSequence struct { ctrl *gomock.Controller recorder *MockSequenceMockRecorder } -// MockSequenceMockRecorder is the mock recorder for MockSequence +// MockSequenceMockRecorder is the mock recorder for MockSequence. type MockSequenceMockRecorder struct { mock *MockSequence } -// NewMockSequence creates a new mock instance +// NewMockSequence creates a new mock instance. func NewMockSequence(ctrl *gomock.Controller) *MockSequence { mock := &MockSequence{ctrl: ctrl} mock.recorder = &MockSequenceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSequence) EXPECT() *MockSequenceMockRecorder { return m.recorder } -// Next mocks base method +// Next mocks base method. func (m *MockSequence) Next() int64 { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Next") @@ -353,8 +767,32 @@ func (m *MockSequence) Next() int64 { return ret0 } -// Next indicates an expected call of Next -func (mr *MockSequenceMockRecorder) Next() *gomock.Call { +// Next indicates an expected call of Next. +func (mr *MockSequenceMockRecorder) Next() *MockSequenceNextCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*MockSequence)(nil).Next)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*MockSequence)(nil).Next)) + return &MockSequenceNextCall{Call: call} +} + +// MockSequenceNextCall wrap *gomock.Call +type MockSequenceNextCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockSequenceNextCall) Return(arg0 int64) *MockSequenceNextCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockSequenceNextCall) Do(f func() int64) *MockSequenceNextCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockSequenceNextCall) DoAndReturn(f func() int64) *MockSequenceNextCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/sql/value.go b/internal/sql/value.go index 867fb96..09e1f62 100644 --- a/internal/sql/value.go +++ b/internal/sql/value.go @@ -1,6 +1,6 @@ package sql -//go:generate mockgen -source=value.go -destination ./value_mock.go -package sql +//go:generate go run go.uber.org/mock/mockgen -typed -source=value.go -destination ./value_mock.go -package sql type Value interface { Raw() any diff --git a/internal/sql/value_mock.go b/internal/sql/value_mock.go index e8550ef..bd04cda 100644 --- a/internal/sql/value_mock.go +++ b/internal/sql/value_mock.go @@ -1,38 +1,82 @@ // Code generated by MockGen. DO NOT EDIT. // Source: value.go +// +// Generated by this command: +// +// mockgen -typed -source=value.go -destination ./value_mock.go -package sql +// // Package sql is a generated GoMock package. package sql import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "go.uber.org/mock/gomock" ) -// MockValue is a mock of Value interface +// MockValue is a mock of Value interface. type MockValue struct { ctrl *gomock.Controller recorder *MockValueMockRecorder } -// MockValueMockRecorder is the mock recorder for MockValue +// MockValueMockRecorder is the mock recorder for MockValue. type MockValueMockRecorder struct { mock *MockValue } -// NewMockValue creates a new mock instance +// NewMockValue creates a new mock instance. func NewMockValue(ctrl *gomock.Controller) *MockValue { mock := &MockValue{ctrl: ctrl} mock.recorder = &MockValueMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockValue) EXPECT() *MockValueMockRecorder { return m.recorder } -// Raw mocks base method +// DataType mocks base method. +func (m *MockValue) DataType() DataType { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DataType") + ret0, _ := ret[0].(DataType) + return ret0 +} + +// DataType indicates an expected call of DataType. +func (mr *MockValueMockRecorder) DataType() *MockValueDataTypeCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DataType", reflect.TypeOf((*MockValue)(nil).DataType)) + return &MockValueDataTypeCall{Call: call} +} + +// MockValueDataTypeCall wrap *gomock.Call +type MockValueDataTypeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockValueDataTypeCall) Return(arg0 DataType) *MockValueDataTypeCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockValueDataTypeCall) Do(f func() DataType) *MockValueDataTypeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockValueDataTypeCall) DoAndReturn(f func() DataType) *MockValueDataTypeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Raw mocks base method. func (m *MockValue) Raw() any { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Raw") @@ -40,13 +84,37 @@ func (m *MockValue) Raw() any { return ret0 } -// Raw indicates an expected call of Raw -func (mr *MockValueMockRecorder) Raw() *gomock.Call { +// Raw indicates an expected call of Raw. +func (mr *MockValueMockRecorder) Raw() *MockValueRawCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Raw", reflect.TypeOf((*MockValue)(nil).Raw)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Raw", reflect.TypeOf((*MockValue)(nil).Raw)) + return &MockValueRawCall{Call: call} } -// String mocks base method +// MockValueRawCall wrap *gomock.Call +type MockValueRawCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *MockValueRawCall) Return(arg0 any) *MockValueRawCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockValueRawCall) Do(f func() any) *MockValueRawCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockValueRawCall) DoAndReturn(f func() any) *MockValueRawCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// String mocks base method. func (m *MockValue) String() string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "String") @@ -54,22 +122,32 @@ func (m *MockValue) String() string { return ret0 } -// String indicates an expected call of String -func (mr *MockValueMockRecorder) String() *gomock.Call { +// String indicates an expected call of String. +func (mr *MockValueMockRecorder) String() *MockValueStringCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockValue)(nil).String)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "String", reflect.TypeOf((*MockValue)(nil).String)) + return &MockValueStringCall{Call: call} } -// DataType mocks base method -func (m *MockValue) DataType() DataType { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DataType") - ret0, _ := ret[0].(DataType) - return ret0 +// MockValueStringCall wrap *gomock.Call +type MockValueStringCall struct { + *gomock.Call } -// DataType indicates an expected call of DataType -func (mr *MockValueMockRecorder) DataType() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DataType", reflect.TypeOf((*MockValue)(nil).DataType)) +// Return rewrite *gomock.Call.Return +func (c *MockValueStringCall) Return(arg0 string) *MockValueStringCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *MockValueStringCall) Do(f func() string) *MockValueStringCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *MockValueStringCall) DoAndReturn(f func() string) *MockValueStringCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/tools.go b/tools.go new file mode 100644 index 0000000..492c9b3 --- /dev/null +++ b/tools.go @@ -0,0 +1,8 @@ +//go:build tools +// +build tools + +package main + +import ( + _ "go.uber.org/mock/mockgen" +)