Skip to content

Commit

Permalink
[*] replace sqlmock mentions with pgxmock in sources
Browse files Browse the repository at this point in the history
  • Loading branch information
pashagolub committed Jun 1, 2021
1 parent 0d96e83 commit 044c17d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion argument_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pgxmock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
6 changes: 3 additions & 3 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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())

Expand All @@ -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())

Expand Down

0 comments on commit 044c17d

Please sign in to comment.