Skip to content

Commit ce254c0

Browse files
committed
refactor
1 parent a56ded4 commit ce254c0

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
### PGX POOL MOCK
22

3-
See file `pgx_pool_mock_test.go` to figure out how to use it.
3+
This repo is mock `pgxpool` in https://github.com/jackc/pgx
4+
5+
### How to install
6+
7+
```
8+
go get github.com/driftprogramming/pgxpoolmock
9+
```
10+
11+
### How to Use
12+
13+
See file `pgx_pool_mock_test.go` to figure out how to use it.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/denghejun/pgxpoolmock
1+
module github.com/driftprogramming/pgxpoolmock
22

33
go 1.16
44

v1/pgx_pool.go renamed to pgx_pool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package v1
1+
package pgxpoolmock
22

33
import (
44
"context"
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package v1_test
1+
package pgxpoolmock_test
22

33
import (
44
"context"
55
"testing"
66

7-
pgxpoolmock2 "github.com/denghejun/pgxpoolmock/v1"
7+
"github.com/driftprogramming/pgxpoolmock"
88
"github.com/golang/mock/gomock"
99
"github.com/stretchr/testify/assert"
1010
)
@@ -18,11 +18,11 @@ func TestName(t *testing.T) {
1818
t.Parallel()
1919
ctrl := gomock.NewController(t)
2020
defer ctrl.Finish()
21-
mockPool := pgxpoolmock2.NewMockPgxPool(ctrl)
21+
mockPool := pgxpoolmock.NewMockPgxPool(ctrl)
2222
columns := []string{"user_name", "age"}
23-
pgxRows := pgxpoolmock2.NewRows(columns).AddRow("Leo", 99).AddRow("Tom", 100).ToPgxRows()
23+
pgxRows := pgxpoolmock.NewRows(columns).AddRow("Leo", 99).AddRow("Tom", 100).ToPgxRows()
2424
mockPool.EXPECT().Query(gomock.Any(), gomock.Any()).Return(pgxRows, nil)
25-
// make sure you pass the `mockPool` to your data access object.
25+
// you can pass the `mockPool` into your data access object here.
2626
actualRows, _ := mockPool.Query(context.Background(), "SELECT MOCK SQL")
2727
var users []user
2828
for actualRows.Next() {

v1/rows.go renamed to rows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package v1
1+
package pgxpoolmock
22

33
import (
44
"encoding/csv"

0 commit comments

Comments
 (0)