fixed
This commit is contained in:
1 parent
4194cef934
commit
363127fe9e
3350 files changed
+1284220
-1
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
package pgxmock
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/jackc/pgx/v4/pgxpool"
|
||||
)
|
||||
|
||||
type pgxmockConn struct {
|
||||
pgxmock
|
||||
}
|
||||
|
||||
// NewConn creates PgxConnIface database connection and a mock to manage expectations.
|
||||
// Accepts options, like ValueConverterOption, to use a ValueConverter from
|
||||
// a specific driver.
|
||||
// Pings db so that all expectations could be
|
||||
// asserted.
|
||||
func NewConn(options ...func(*pgxmock) error) (PgxConnIface, error) {
|
||||
smock := &pgxmockConn{}
|
||||
smock.ordered = true
|
||||
return smock, smock.open(options)
|
||||
}
|
||||
|
||||
func (c *pgxmockConn) Close(ctx context.Context) error {
|
||||
return c.close(ctx)
|
||||
}
|
||||
|
||||
type pgxmockPool struct {
|
||||
pgxmock
|
||||
}
|
||||
|
||||
// NewPool creates PgxPoolIface pool of database connections and a mock to manage expectations.
|
||||
// Accepts options, like ValueConverterOption, to use a ValueConverter from
|
||||
// a specific driver.
|
||||
// Pings db so that all expectations could be
|
||||
// asserted.
|
||||
func NewPool(options ...func(*pgxmock) error) (PgxPoolIface, error) {
|
||||
smock := &pgxmockPool{}
|
||||
smock.ordered = true
|
||||
return smock, smock.open(options)
|
||||
}
|
||||
|
||||
func (p *pgxmockPool) Close() {
|
||||
_ = p.close(context.Background())
|
||||
}
|
||||
|
||||
func (p *pgxmockPool) Acquire(ctx context.Context) (*pgxpool.Conn, error) {
|
||||
return nil, errors.New("pgpool.Acquire() method is not implemented")
|
||||
}
|
||||
Reference in new issue
Block a user