Replace interface{} with any
This commit is contained in:
@@ -30,7 +30,7 @@ func (f Float8) Float64Value() (pgtype.Float8, error) {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (f *Float8) Scan(src interface{}) error {
|
||||
func (f *Float8) Scan(src any) error {
|
||||
if src == nil {
|
||||
*f = 0
|
||||
return nil
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxtest"
|
||||
)
|
||||
|
||||
func isExpectedEq(a interface{}) func(interface{}) bool {
|
||||
return func(v interface{}) bool {
|
||||
func isExpectedEq(a any) func(any) bool {
|
||||
return func(v any) bool {
|
||||
return a == v
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func TestFloat8Transcode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Float8)(0),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -32,7 +32,7 @@ func (dst *Int2) ScanInt64(n int64, valid bool) error {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Int2) Scan(src interface{}) error {
|
||||
func (dst *Int2) Scan(src any) error {
|
||||
if src == nil {
|
||||
*dst = 0
|
||||
return nil
|
||||
@@ -80,7 +80,7 @@ func (dst *Int4) ScanInt64(n int64, valid bool) error {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Int4) Scan(src interface{}) error {
|
||||
func (dst *Int4) Scan(src any) error {
|
||||
if src == nil {
|
||||
*dst = 0
|
||||
return nil
|
||||
@@ -128,7 +128,7 @@ func (dst *Int8) ScanInt64(n int64, valid bool) error {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Int8) Scan(src interface{}) error {
|
||||
func (dst *Int8) Scan(src any) error {
|
||||
if src == nil {
|
||||
*dst = 0
|
||||
return nil
|
||||
|
||||
@@ -33,7 +33,7 @@ func (dst *Int<%= pg_byte_size %>) ScanInt64(n int64, valid bool) error {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Int<%= pg_byte_size %>) Scan(src interface{}) error {
|
||||
func (dst *Int<%= pg_byte_size %>) Scan(src any) error {
|
||||
if src == nil {
|
||||
*dst = 0
|
||||
return nil
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestInt2Transcode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Int2)(0),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
@@ -43,7 +43,7 @@ func TestInt4Transcode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Int4)(0),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
@@ -63,7 +63,7 @@ func TestInt8Transcode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Int8)(0),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestInt<%= pg_byte_size %>Transcode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Int<%= pg_byte_size %>)(0),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ func (dst *Text) ScanText(v pgtype.Text) error {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Text) Scan(src interface{}) error {
|
||||
func (dst *Text) Scan(src any) error {
|
||||
if src == nil {
|
||||
*dst = ""
|
||||
return nil
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestTextTranscode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Text)(""),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -40,7 +40,7 @@ func (ts Timestamp) TimestampValue() (pgtype.Timestamp, error) {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (ts *Timestamp) Scan(src interface{}) error {
|
||||
func (ts *Timestamp) Scan(src any) error {
|
||||
if src == nil {
|
||||
*ts = Timestamp{}
|
||||
return nil
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxtest"
|
||||
)
|
||||
|
||||
func isExpectedEqTimestamp(a interface{}) func(interface{}) bool {
|
||||
return func(v interface{}) bool {
|
||||
func isExpectedEqTimestamp(a any) func(any) bool {
|
||||
return func(v any) bool {
|
||||
at := time.Time(a.(zeronull.Timestamp))
|
||||
vt := time.Time(v.(zeronull.Timestamp))
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestTimestampTranscode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Timestamp)(time.Time{}),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -40,7 +40,7 @@ func (ts Timestamptz) TimestamptzValue() (pgtype.Timestamptz, error) {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (ts *Timestamptz) Scan(src interface{}) error {
|
||||
func (ts *Timestamptz) Scan(src any) error {
|
||||
if src == nil {
|
||||
*ts = Timestamptz{}
|
||||
return nil
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/jackc/pgx/v5/pgxtest"
|
||||
)
|
||||
|
||||
func isExpectedEqTimestamptz(a interface{}) func(interface{}) bool {
|
||||
return func(v interface{}) bool {
|
||||
func isExpectedEqTimestamptz(a any) func(any) bool {
|
||||
return func(v any) bool {
|
||||
at := time.Time(a.(zeronull.Timestamptz))
|
||||
vt := time.Time(v.(zeronull.Timestamptz))
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestTimestamptzTranscode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.Timestamptz)(time.Time{}),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -30,7 +30,7 @@ func (u UUID) UUIDValue() (pgtype.UUID, error) {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (u *UUID) Scan(src interface{}) error {
|
||||
func (u *UUID) Scan(src any) error {
|
||||
if src == nil {
|
||||
*u = UUID{}
|
||||
return nil
|
||||
|
||||
@@ -22,7 +22,7 @@ func TestUUIDTranscode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
(zeronull.UUID)([16]byte{}),
|
||||
new(interface{}),
|
||||
new(any),
|
||||
isExpectedEq(nil),
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user