Passthrough all parameters directly to pgx
This commit is contained in:
@@ -373,6 +373,11 @@ func (c *Conn) Ping(ctx context.Context) error {
|
|||||||
return c.conn.Ping(ctx)
|
return c.conn.Ping(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conn) CheckNamedValue(*driver.NamedValue) error {
|
||||||
|
// Underlying pgx supports sql.Scanner and driver.Valuer interfaces natively. So everything can be passed through directly.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type Stmt struct {
|
type Stmt struct {
|
||||||
sd *pgconn.StatementDescription
|
sd *pgconn.StatementDescription
|
||||||
conn *Conn
|
conn *Conn
|
||||||
|
|||||||
@@ -321,6 +321,15 @@ func TestConnQueryFailure(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConnSimpleSlicePassThrough(t *testing.T) {
|
||||||
|
testWithAndWithoutPreferSimpleProtocol(t, func(t *testing.T, db *sql.DB) {
|
||||||
|
var n int64
|
||||||
|
err := db.QueryRow("select cardinality($1::text[])", []string{"a", "b", "c"}).Scan(&n)
|
||||||
|
require.NoError(t, err)
|
||||||
|
assert.EqualValues(t, 3, n)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Test type that pgx would handle natively in binary, but since it is not a
|
// Test type that pgx would handle natively in binary, but since it is not a
|
||||||
// database/sql native type should be passed through as a string
|
// database/sql native type should be passed through as a string
|
||||||
func TestConnQueryRowPgxBinary(t *testing.T) {
|
func TestConnQueryRowPgxBinary(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user