From 044c17d3b26154f012c6cf920568a840c68d5fd4 Mon Sep 17 00:00:00 2001 From: Pavlo Golub Date: Tue, 1 Jun 2021 14:37:30 +0300 Subject: [PATCH] [*] replace sqlmock mentions with pgxmock in sources --- argument_test.go | 2 +- expectations.go | 12 ++++++------ options.go | 2 +- pgxmock_test.go | 2 +- query.go | 6 +++--- query_test.go | 2 +- rows.go | 4 ++-- rows_test.go | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/argument_test.go b/argument_test.go index eb358d3..d71e835 100644 --- a/argument_test.go +++ b/argument_test.go @@ -8,7 +8,7 @@ import ( type AnyTime struct{} -// Match satisfies sqlmock.Argument interface +// Match satisfies pgxmock.Argument interface func (a AnyTime) Match(v interface{}) bool { _, ok := v.(time.Time) return ok diff --git a/expectations.go b/expectations.go index f027a27..66c6d2b 100644 --- a/expectations.go +++ b/expectations.go @@ -137,7 +137,7 @@ type ExpectedQuery struct { // WithArgs will match given expected args to actual database query arguments. // if at least one argument does not match, it will return an error. For specific -// arguments an sqlmock.Argument interface can be used to match an argument. +// arguments an pgxmock.Argument interface can be used to match an argument. func (e *ExpectedQuery) WithArgs(args ...interface{}) *ExpectedQuery { e.args = args return e @@ -198,7 +198,7 @@ type ExpectedExec struct { // WithArgs will match given expected args to actual database exec operation arguments. // if at least one argument does not match, it will return an error. For specific -// arguments an sqlmock.Argument interface can be used to match an argument. +// arguments an pgxmock.Argument interface can be used to match an argument. func (e *ExpectedExec) WithArgs(args ...interface{}) *ExpectedExec { e.args = args return e @@ -246,9 +246,9 @@ func (e *ExpectedExec) String() string { } // WillReturnResult arranges for an expected Exec() to return a particular -// result, there is sqlmock.NewResult(lastInsertID int64, affectedRows int64) method +// result, there is pgxmock.NewResult(lastInsertID int64, affectedRows int64) method // to build a corresponding result. Or if actions needs to be tested against errors -// sqlmock.NewErrorResult(err error) to return a given error. +// pgxmock.NewErrorResult(err error) to return a given error. func (e *ExpectedExec) WillReturnResult(result pgconn.CommandTag) *ExpectedExec { e.result = result return e @@ -463,9 +463,9 @@ func (e *ExpectedCopyFrom) String() string { } // WillReturnResult arranges for an expected Exec() to return a particular -// result, there is sqlmock.NewResult(lastInsertID int64, affectedRows int64) method +// result, there is pgxmock.NewResult(lastInsertID int64, affectedRows int64) method // to build a corresponding result. Or if actions needs to be tested against errors -// sqlmock.NewErrorResult(err error) to return a given error. +// pgxmock.NewErrorResult(err error) to return a given error. func (e *ExpectedCopyFrom) WillReturnResult(result int64) *ExpectedCopyFrom { e.rowsAffected = result return e diff --git a/options.go b/options.go index 8b77f6a..c33b121 100644 --- a/options.go +++ b/options.go @@ -1,6 +1,6 @@ package pgxmock -// ValueConverterOption allows to create a sqlmock connection +// ValueConverterOption allows to create a pgxmock connection // with a custom ValueConverter to support drivers with special data types. // func ValueConverterOption(converter driver.ValueConverter) func(*pgxmock) error { // return func(s *pgxmock) error { diff --git a/pgxmock_test.go b/pgxmock_test.go index 8310141..eeec91d 100644 --- a/pgxmock_test.go +++ b/pgxmock_test.go @@ -638,7 +638,7 @@ func TestGoroutineExecutionWithUnorderedExpectationMatching(t *testing.T) { // func Test_goroutines() { // mock, err := NewConn() // if err != nil { -// fmt.Println("failed to open sqlmock database:", err) +// fmt.Println("failed to open pgxmock database:", err) // } // defer mock.Close(context.Background()) diff --git a/query.go b/query.go index 1288d3b..7e5e1af 100644 --- a/query.go +++ b/query.go @@ -18,8 +18,8 @@ func stripQuery(q string) (s string) { // As an example, external library could be used to build // and validate SQL ast, columns selected. // -// sqlmock can be customized to implement a different QueryMatcher -// configured through an option when sqlmock.New or sqlmock.NewWithDSN +// pgxmock can be customized to implement a different QueryMatcher +// configured through an option when pgxmock.New or pgxmock.NewWithDSN // is called, default QueryMatcher is QueryMatcherRegexp. type QueryMatcher interface { @@ -40,7 +40,7 @@ func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error { } // QueryMatcherRegexp is the default SQL query matcher -// used by sqlmock. It parses expectedSQL to a regular +// used by pgxmock. It parses expectedSQL to a regular // expression and attempts to match actualSQL. var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error { expect := stripQuery(expectedSQL) diff --git a/query_test.go b/query_test.go index c342481..9b7bba1 100644 --- a/query_test.go +++ b/query_test.go @@ -11,7 +11,7 @@ func ExampleQueryMatcher() { // instead of default regular expression matcher mock, err := NewConn(QueryMatcherOption(QueryMatcherEqual)) if err != nil { - fmt.Println("failed to open sqlmock database:", err) + fmt.Println("failed to open pgxmock database:", err) } // defer db.Close() diff --git a/rows.go b/rows.go index 95d3e94..0b9d7af 100644 --- a/rows.go +++ b/rows.go @@ -165,7 +165,7 @@ type Rows struct { // NewRows allows Rows to be created from a // sql interface{} slice or from the CSV string and // to be used as sql driver.Rows. -// Use Sqlmock.NewRows instead if using a custom converter +// Use pgxmock.NewRows instead if using a custom converter func NewRows(columns []string) *Rows { var coldefs []pgproto3.FieldDescription for _, column := range columns { @@ -250,7 +250,7 @@ func (rs *rowSets) NextResultSet() error { return nil } -// type for rows with columns definition created with sqlmock.NewRowsWithColumnDefinition +// type for rows with columns definition created with pgxmock.NewRowsWithColumnDefinition type rowSetsWithDefinition struct { *rowSets } diff --git a/rows_test.go b/rows_test.go index bdb8b6a..0250356 100644 --- a/rows_test.go +++ b/rows_test.go @@ -11,7 +11,7 @@ import ( func ExampleRows() { mock, err := NewConn() if err != nil { - fmt.Println("failed to open sqlmock database:", err) + fmt.Println("failed to open pgxmock database:", err) } // defer mock.Close(context.Background()) @@ -41,7 +41,7 @@ func ExampleRows() { func ExampleRows_rowError() { mock, err := NewConn() if err != nil { - fmt.Println("failed to open sqlmock database:", err) + fmt.Println("failed to open pgxmock database:", err) } // defer mock.Close(context.Background()) @@ -72,7 +72,7 @@ func ExampleRows_rowError() { func ExampleRows_expectToBeClosed() { mock, err := NewConn() if err != nil { - fmt.Println("failed to open sqlmock database:", err) + fmt.Println("failed to open pgxmock database:", err) } defer mock.Close(context.Background()) @@ -95,7 +95,7 @@ func ExampleRows_expectToBeClosed() { // func ExampleRows_customDriverValue() { // mock, err := New() // if err != nil { -// fmt.Println("failed to open sqlmock database:", err) +// fmt.Println("failed to open pgxmock database:", err) // } // defer mock.Close(context.Background())