Skip to content

Commit 6ea2d24

Browse files
committed
Remove anynil.NormalizeSlice
anynil.Is was already being called in all paths that anynil.NormalizeSlice was used.
1 parent c1075bf commit 6ea2d24

File tree

3 files changed

+0
-14
lines changed

3 files changed

+0
-14
lines changed

conn.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"strings"
1111
"time"
1212

13-
"github.com/jackc/pgx/v5/internal/anynil"
1413
"github.com/jackc/pgx/v5/internal/sanitize"
1514
"github.com/jackc/pgx/v5/internal/stmtcache"
1615
"github.com/jackc/pgx/v5/pgconn"
@@ -755,7 +754,6 @@ optionLoop:
755754
}
756755

757756
c.eqb.reset()
758-
anynil.NormalizeSlice(args)
759757
rows := c.getRows(ctx, sql, args)
760758

761759
var err error

extended_query_builder.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ type ExtendedQueryBuilder struct {
2222
func (eqb *ExtendedQueryBuilder) Build(m *pgtype.Map, sd *pgconn.StatementDescription, args []any) error {
2323
eqb.reset()
2424

25-
anynil.NormalizeSlice(args)
26-
2725
if sd == nil {
2826
for i := range args {
2927
err := eqb.appendParam(m, 0, pgtype.TextFormatCode, args[i])

internal/anynil/anynil.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,3 @@ func Is(value any) bool {
4444
return false
4545
}
4646
}
47-
48-
// NormalizeSlice converts all typed nils (e.g. []byte(nil)) in s into untyped nils. Other values are unmodified. s is
49-
// mutated in place.
50-
func NormalizeSlice(s []any) {
51-
for i := range s {
52-
if Is(s[i]) {
53-
s[i] = nil
54-
}
55-
}
56-
}

0 commit comments

Comments
 (0)