Skip to content

Commit

Permalink
Merge pull request #100 from pashagolub/97-update-pgx-to-v5
Browse files Browse the repository at this point in the history
[!] add support for `jackc/pgx/v5`, closes #97
  • Loading branch information
pashagolub authored Sep 21, 2022
2 parents 9be33e0 + 714a773 commit 38d7bf4
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 561 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ package main
import (
"context"

pgx "github.com/jackc/pgx/v4"
pgx "github.com/jackc/pgx/v5"
)

type PgxIface interface {
Expand Down
2 changes: 1 addition & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"errors"

"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v5/pgxpool"
)

type pgxmockConn struct {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"

pgx "github.com/jackc/pgx/v4"
pgx "github.com/jackc/pgx/v5"
)

type PgxIface interface {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/pashagolub/pgxmock"
"github.com/pashagolub/pgxmock/v2"
)

// a successful case
Expand Down
4 changes: 2 additions & 2 deletions examples/blog/blog.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"net/http"

pgconn "github.com/jackc/pgconn"
pgx "github.com/jackc/pgx/v4"
pgx "github.com/jackc/pgx/v5"
pgconn "github.com/jackc/pgx/v5/pgconn"
)

type PgxIface interface {
Expand Down
2 changes: 1 addition & 1 deletion examples/blog/blog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http/httptest"
"testing"

"github.com/pashagolub/pgxmock"
"github.com/pashagolub/pgxmock/v2"
)

func (a *api) assertJSON(actual []byte, data interface{}, t *testing.T) {
Expand Down
132 changes: 0 additions & 132 deletions examples/orders/orders.go

This file was deleted.

109 changes: 0 additions & 109 deletions examples/orders/orders_test.go

This file was deleted.

20 changes: 4 additions & 16 deletions expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"sync"
"time"

"github.com/jackc/pgconn"
pgx "github.com/jackc/pgx/v4"
pgx "github.com/jackc/pgx/v5"
pgconn "github.com/jackc/pgx/v5/pgconn"
)

// an expectation interface
Expand Down Expand Up @@ -233,7 +233,7 @@ func (e *ExpectedExec) String() string {
msg += strings.Join(margs, "\n")
}

if e.result != nil {
if e.result.String() > "" {
msg += "\n - should return Result having:"
msg += fmt.Sprintf("\n RowsAffected: %d", e.result.RowsAffected())
}
Expand Down Expand Up @@ -371,19 +371,7 @@ func (e *ExpectedPing) String() string {
// WillReturnRows specifies the set of resulting rows that will be returned
// by the triggered query
func (e *ExpectedQuery) WillReturnRows(rows ...*Rows) *ExpectedQuery {
defs := 0
sets := make([]*Rows, len(rows))
for i, r := range rows {
sets[i] = r
if r.defs != nil {
defs++
}
}
if defs > 0 && defs == len(sets) {
e.rows = &rowSetsWithDefinition{&rowSets{sets: sets, ex: e}}
} else {
e.rows = &rowSets{sets: sets, ex: e}
}
e.rows = &rowSets{sets: rows, ex: e}
return e
}

Expand Down
18 changes: 5 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
module github.com/pashagolub/pgxmock
module github.com/pashagolub/pgxmock/v2

go 1.17
go 1.19

require (
github.com/jackc/pgconn v1.13.0
github.com/jackc/pgproto3/v2 v2.3.1
github.com/jackc/pgtype v1.12.0
github.com/jackc/pgx/v4 v4.17.2
github.com/pashagolub/pgxstruct v0.0.0-20210217101842-40d357eec200
)
require github.com/jackc/pgx/v5 v5.0.0

require (
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/puddle v1.3.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
github.com/jackc/puddle/v2 v2.0.0 // indirect
golang.org/x/crypto v0.0.0-20220919173607-35f4265a4bc0 // indirect
golang.org/x/text v0.3.7 // indirect
)
Loading

0 comments on commit 38d7bf4

Please sign in to comment.