mirror of https://github.com/jackc/pgx.git
Remove anynil.NormalizeSlice
anynil.Is was already being called in all paths that anynil.NormalizeSlice was used.pull/2019/head
parent
c1075bfff0
commit
6ea2d248a3
2
conn.go
2
conn.go
|
@ -10,7 +10,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5/internal/anynil"
|
|
||||||
"github.com/jackc/pgx/v5/internal/sanitize"
|
"github.com/jackc/pgx/v5/internal/sanitize"
|
||||||
"github.com/jackc/pgx/v5/internal/stmtcache"
|
"github.com/jackc/pgx/v5/internal/stmtcache"
|
||||||
"github.com/jackc/pgx/v5/pgconn"
|
"github.com/jackc/pgx/v5/pgconn"
|
||||||
|
@ -755,7 +754,6 @@ optionLoop:
|
||||||
}
|
}
|
||||||
|
|
||||||
c.eqb.reset()
|
c.eqb.reset()
|
||||||
anynil.NormalizeSlice(args)
|
|
||||||
rows := c.getRows(ctx, sql, args)
|
rows := c.getRows(ctx, sql, args)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -22,8 +22,6 @@ type ExtendedQueryBuilder struct {
|
||||||
func (eqb *ExtendedQueryBuilder) Build(m *pgtype.Map, sd *pgconn.StatementDescription, args []any) error {
|
func (eqb *ExtendedQueryBuilder) Build(m *pgtype.Map, sd *pgconn.StatementDescription, args []any) error {
|
||||||
eqb.reset()
|
eqb.reset()
|
||||||
|
|
||||||
anynil.NormalizeSlice(args)
|
|
||||||
|
|
||||||
if sd == nil {
|
if sd == nil {
|
||||||
for i := range args {
|
for i := range args {
|
||||||
err := eqb.appendParam(m, 0, pgtype.TextFormatCode, args[i])
|
err := eqb.appendParam(m, 0, pgtype.TextFormatCode, args[i])
|
||||||
|
|
|
@ -44,13 +44,3 @@ func Is(value any) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NormalizeSlice converts all typed nils (e.g. []byte(nil)) in s into untyped nils. Other values are unmodified. s is
|
|
||||||
// mutated in place.
|
|
||||||
func NormalizeSlice(s []any) {
|
|
||||||
for i := range s {
|
|
||||||
if Is(s[i]) {
|
|
||||||
s[i] = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue