Examples to mock pgx
All examples are based on pgxmock and pgxpoolmock, thanks for the great works from the authors of these repositories!
This repo add some mock examples based on different structure level.
pgxmock | pgxmock/v3 | pgxpoolmock | |
---|---|---|---|
pgx version | v4 | v5 | v4 |
pgx.Conn mock | ✔️ | ✔️ | ❌ |
pgxpool.Pool mock | ✔️ | ✔️ | ✔️ |
pgxpool.Conn mock | ✔️ | ✔️ | ❌ |
You can see the mock examples for pgx/v4
on the branch v4
, also the branch v5
for pgx/v5
. Of course pgx/v5
is recommended :)
- Mock level
pgx.Conn
, see pgxconn.go and pgxconn_test.go - Mock level
pgxpool.Pool
, see pgxpool.go and pgxpool_test.go - Mock level
pgxpool.Conn
, see pgxpoolconn.go and pgxpoolconn_test.go