Skip to content

Commit 0bbdf76

Browse files
committed
Separated sqlExecuterInterface into its own file and added go:generate command to generate mock_sql_executor
1 parent 68f1af4 commit 0bbdf76

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

go/vt/tabletserver/splitquery/split_algorithm_interface.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,3 @@ type tuple []sqltypes.Value
1818
type SplitAlgorithmInterface interface {
1919
generateBoundaries() ([]tuple, error)
2020
}
21-
22-
// SQLExecuter enacpsulates access to the MySQL database.
23-
type SQLExecuter interface {
24-
SQLExecute(sql string, bindVariables map[string]interface{}) (*sqltypes.Result, error)
25-
}

go/vt/tabletserver/splitquery/splitquery_testing/mock_sqlexecuter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Automatically generated by MockGen. DO NOT EDIT!
2-
// Source: github.com/youtube/vitess/go/vt/tabletserver/splitquery (interfaces: SQLExecuter)
2+
// Source: sql_executer_interface.go
33

44
package splitquery_testing
55

@@ -29,8 +29,8 @@ func (_m *MockSQLExecuter) EXPECT() *_MockSQLExecuterRecorder {
2929
return _m.recorder
3030
}
3131

32-
func (_m *MockSQLExecuter) SQLExecute(_param0 string, _param1 map[string]interface{}) (*sqltypes.Result, error) {
33-
ret := _m.ctrl.Call(_m, "SQLExecute", _param0, _param1)
32+
func (_m *MockSQLExecuter) SQLExecute(sql string, bindVariables map[string]interface{}) (*sqltypes.Result, error) {
33+
ret := _m.ctrl.Call(_m, "SQLExecute", sql, bindVariables)
3434
ret0, _ := ret[0].(*sqltypes.Result)
3535
ret1, _ := ret[1].(error)
3636
return ret0, ret1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package splitquery
2+
3+
import "github.com/youtube/vitess/go/sqltypes"
4+
5+
// SQLExecuter enacpsulates access to the MySQL database for the this package.
6+
type SQLExecuter interface {
7+
SQLExecute(sql string, bindVariables map[string]interface{}) (*sqltypes.Result, error)
8+
}
9+
10+
//TODO(erez): Shorten this filename to sql_executor.go
11+
12+
// Command to generate a mock for this interface with mockgen.
13+
//go:generate mockgen -source $GOFILE -destination splitquery_testing/mock_sqlexecuter.go -package splitquery_testing

0 commit comments

Comments
 (0)