1 package sqlmock 2 3 import "database/sql/driver" 4 5 // ValueConverterOption allows to create a sqlmock connection 6 // with a custom ValueConverter to support drivers with special data types. 7 func ValueConverterOption(converter driver.ValueConverter) func(*sqlmock) error { 8 return func(s *sqlmock) error { 9 s.converter = converter 10 return nil 11 } 12 } 13 14 // QueryMatcherOption allows to customize SQL query matcher 15 // and match SQL query strings in more sophisticated ways. 16 // The default QueryMatcher is QueryMatcherRegexp. 17 func QueryMatcherOption(queryMatcher QueryMatcher) func(*sqlmock) error { 18 return func(s *sqlmock) error { 19 s.queryMatcher = queryMatcher 20 return nil 21 } 22 } 23 24 // MonitorPingsOption determines whether calls to Ping on the driver should be 25 // observed and mocked. 26 // 27 // If true is passed, we will check these calls were expected. Expectations can 28 // be registered using the ExpectPing() method on the mock. 29 // 30 // If false is passed or this option is omitted, calls to Ping will not be 31 // considered when determining expectations and calls to ExpectPing will have 32 // no effect. 33 func MonitorPingsOption(monitorPings bool) func(*sqlmock) error { 34 return func(s *sqlmock) error { 35 s.monitorPings = monitorPings 36 return nil 37 } 38 } 39