Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ConnInfo method to pgx interface #86

Merged
merged 2 commits into from
Aug 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pgxmock.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

"github.com/jackc/pgconn"
"github.com/jackc/pgproto3/v2"
"github.com/jackc/pgtype"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
)
Expand Down Expand Up @@ -106,6 +107,8 @@ type pgxMockIface interface {

// New Column allows to create a Column
NewColumn(name string) *pgproto3.FieldDescription

ConnInfo() *pgtype.ConnInfo
pashagolub marked this conversation as resolved.
Show resolved Hide resolved
}

type pgxIface interface {
Expand All @@ -120,6 +123,7 @@ type pgxIface interface {
Ping(context.Context) error
Prepare(context.Context, string, string) (*pgconn.StatementDescription, error)
Deallocate(ctx context.Context, name string) error
ConnInfo() *pgtype.ConnInfo
}

type PgxConnIface interface {
Expand Down Expand Up @@ -253,6 +257,11 @@ func (c *pgxmock) NewRows(columns []string) *Rows {
return r
}

func (c *pgxmock) ConnInfo() *pgtype.ConnInfo {
ci := pgtype.ConnInfo{}
return &ci
}

// NewRowsWithColumnDefinition allows Rows to be created from a
// sql driver.Value slice with a definition of sql metadata
func (c *pgxmock) NewRowsWithColumnDefinition(columns ...pgproto3.FieldDescription) *Rows {
Expand Down