@@ -2,9 +2,12 @@ package sqlmock
2
2
3
3
import "database/sql/driver"
4
4
5
+ // SqlMockOption is the type defining an option used to configure an SqlMock at creation
6
+ type SqlMockOption func (* sqlmock ) error
7
+
5
8
// ValueConverterOption allows to create a sqlmock connection
6
9
// with a custom ValueConverter to support drivers with special data types.
7
- func ValueConverterOption (converter driver.ValueConverter ) func ( * sqlmock ) error {
10
+ func ValueConverterOption (converter driver.ValueConverter ) SqlMockOption {
8
11
return func (s * sqlmock ) error {
9
12
s .converter = converter
10
13
return nil
@@ -14,7 +17,7 @@ func ValueConverterOption(converter driver.ValueConverter) func(*sqlmock) error
14
17
// QueryMatcherOption allows to customize SQL query matcher
15
18
// and match SQL query strings in more sophisticated ways.
16
19
// The default QueryMatcher is QueryMatcherRegexp.
17
- func QueryMatcherOption (queryMatcher QueryMatcher ) func ( * sqlmock ) error {
20
+ func QueryMatcherOption (queryMatcher QueryMatcher ) SqlMockOption {
18
21
return func (s * sqlmock ) error {
19
22
s .queryMatcher = queryMatcher
20
23
return nil
@@ -30,7 +33,7 @@ func QueryMatcherOption(queryMatcher QueryMatcher) func(*sqlmock) error {
30
33
// If false is passed or this option is omitted, calls to Ping will not be
31
34
// considered when determining expectations and calls to ExpectPing will have
32
35
// no effect.
33
- func MonitorPingsOption (monitorPings bool ) func ( * sqlmock ) error {
36
+ func MonitorPingsOption (monitorPings bool ) SqlMockOption {
34
37
return func (s * sqlmock ) error {
35
38
s .monitorPings = monitorPings
36
39
return nil
0 commit comments