diff --git a/pgtype/aclitem.go b/pgtype/aclitem.go index 36cf3bbf..b8a1549e 100644 --- a/pgtype/aclitem.go +++ b/pgtype/aclitem.go @@ -25,8 +25,6 @@ type Aclitem struct { func (dst *Aclitem) Set(src interface{}) error { switch value := src.(type) { - case Aclitem: - *dst = value case string: *dst = Aclitem{String: value, Status: Present} case *string: diff --git a/pgtype/aclitem_array.go b/pgtype/aclitem_array.go index 13952e5c..5e3647b7 100644 --- a/pgtype/aclitem_array.go +++ b/pgtype/aclitem_array.go @@ -16,8 +16,6 @@ type AclitemArray struct { func (dst *AclitemArray) Set(src interface{}) error { switch value := src.(type) { - case AclitemArray: - *dst = value case []string: if value == nil { diff --git a/pgtype/aclitem_test.go b/pgtype/aclitem_test.go index 47e6fa84..1738025a 100644 --- a/pgtype/aclitem_test.go +++ b/pgtype/aclitem_test.go @@ -20,7 +20,6 @@ func TestAclitemSet(t *testing.T) { source interface{} result pgtype.Aclitem }{ - {source: pgtype.Aclitem{String: "postgres=arwdDxt/postgres", Status: pgtype.Present}, result: pgtype.Aclitem{String: "postgres=arwdDxt/postgres", Status: pgtype.Present}}, {source: "postgres=arwdDxt/postgres", result: pgtype.Aclitem{String: "postgres=arwdDxt/postgres", Status: pgtype.Present}}, {source: (*string)(nil), result: pgtype.Aclitem{Status: pgtype.Null}}, } diff --git a/pgtype/bool.go b/pgtype/bool.go index 04a261c2..a8e9b8e1 100644 --- a/pgtype/bool.go +++ b/pgtype/bool.go @@ -14,8 +14,6 @@ type Bool struct { func (dst *Bool) Set(src interface{}) error { switch value := src.(type) { - case Bool: - *dst = value case bool: *dst = Bool{Bool: value, Status: Present} case string: diff --git a/pgtype/bool_array.go b/pgtype/bool_array.go index fdcbf7a0..4c5fc563 100644 --- a/pgtype/bool_array.go +++ b/pgtype/bool_array.go @@ -17,8 +17,6 @@ type BoolArray struct { func (dst *BoolArray) Set(src interface{}) error { switch value := src.(type) { - case BoolArray: - *dst = value case []bool: if value == nil { diff --git a/pgtype/bool_test.go b/pgtype/bool_test.go index 773bd99b..412e2fd0 100644 --- a/pgtype/bool_test.go +++ b/pgtype/bool_test.go @@ -20,7 +20,6 @@ func TestBoolSet(t *testing.T) { source interface{} result pgtype.Bool }{ - {source: pgtype.Bool{Bool: false, Status: pgtype.Null}, result: pgtype.Bool{Bool: false, Status: pgtype.Null}}, {source: true, result: pgtype.Bool{Bool: true, Status: pgtype.Present}}, {source: false, result: pgtype.Bool{Bool: false, Status: pgtype.Present}}, {source: "true", result: pgtype.Bool{Bool: true, Status: pgtype.Present}}, diff --git a/pgtype/bytea.go b/pgtype/bytea.go index a8ee55ae..5df05360 100644 --- a/pgtype/bytea.go +++ b/pgtype/bytea.go @@ -14,8 +14,6 @@ type Bytea struct { func (dst *Bytea) Set(src interface{}) error { switch value := src.(type) { - case Bytea: - *dst = value case []byte: if value != nil { *dst = Bytea{Bytes: value, Status: Present} diff --git a/pgtype/bytea_array.go b/pgtype/bytea_array.go index 5362944a..c6f676a4 100644 --- a/pgtype/bytea_array.go +++ b/pgtype/bytea_array.go @@ -17,8 +17,6 @@ type ByteaArray struct { func (dst *ByteaArray) Set(src interface{}) error { switch value := src.(type) { - case ByteaArray: - *dst = value case [][]byte: if value == nil { diff --git a/pgtype/bytea_test.go b/pgtype/bytea_test.go index 4655a1c1..e21296c6 100644 --- a/pgtype/bytea_test.go +++ b/pgtype/bytea_test.go @@ -20,7 +20,6 @@ func TestByteaSet(t *testing.T) { source interface{} result pgtype.Bytea }{ - {source: pgtype.Bytea{Bytes: []byte{1, 2, 3}, Status: pgtype.Null}, result: pgtype.Bytea{Bytes: []byte{1, 2, 3}, Status: pgtype.Null}}, {source: []byte{1, 2, 3}, result: pgtype.Bytea{Bytes: []byte{1, 2, 3}, Status: pgtype.Present}}, {source: []byte{}, result: pgtype.Bytea{Bytes: []byte{}, Status: pgtype.Present}}, {source: []byte(nil), result: pgtype.Bytea{Status: pgtype.Null}}, diff --git a/pgtype/date.go b/pgtype/date.go index a3b8d99f..d0481637 100644 --- a/pgtype/date.go +++ b/pgtype/date.go @@ -23,8 +23,6 @@ const ( func (dst *Date) Set(src interface{}) error { switch value := src.(type) { - case Date: - *dst = value case time.Time: *dst = Date{Time: value, Status: Present} default: diff --git a/pgtype/date_array.go b/pgtype/date_array.go index ce28e236..7f602d83 100644 --- a/pgtype/date_array.go +++ b/pgtype/date_array.go @@ -18,8 +18,6 @@ type DateArray struct { func (dst *DateArray) Set(src interface{}) error { switch value := src.(type) { - case DateArray: - *dst = value case []time.Time: if value == nil { diff --git a/pgtype/date_test.go b/pgtype/date_test.go index eff3a521..cfc3dd70 100644 --- a/pgtype/date_test.go +++ b/pgtype/date_test.go @@ -29,7 +29,6 @@ func TestDateSet(t *testing.T) { source interface{} result pgtype.Date }{ - {source: pgtype.Date{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}, result: pgtype.Date{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, {source: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), result: pgtype.Date{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, {source: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC), result: pgtype.Date{Time: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, {source: time.Date(1999, 12, 31, 0, 0, 0, 0, time.UTC), result: pgtype.Date{Time: time.Date(1999, 12, 31, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, diff --git a/pgtype/float4.go b/pgtype/float4.go index a38d24db..053af44b 100644 --- a/pgtype/float4.go +++ b/pgtype/float4.go @@ -17,8 +17,6 @@ type Float4 struct { func (dst *Float4) Set(src interface{}) error { switch value := src.(type) { - case Float4: - *dst = value case float32: *dst = Float4{Float: value, Status: Present} case float64: diff --git a/pgtype/float4_array.go b/pgtype/float4_array.go index 410a8b37..0e815e0b 100644 --- a/pgtype/float4_array.go +++ b/pgtype/float4_array.go @@ -17,8 +17,6 @@ type Float4Array struct { func (dst *Float4Array) Set(src interface{}) error { switch value := src.(type) { - case Float4Array: - *dst = value case []float32: if value == nil { diff --git a/pgtype/float8.go b/pgtype/float8.go index 9129e8ba..635b7a09 100644 --- a/pgtype/float8.go +++ b/pgtype/float8.go @@ -17,8 +17,6 @@ type Float8 struct { func (dst *Float8) Set(src interface{}) error { switch value := src.(type) { - case Float8: - *dst = value case float32: *dst = Float8{Float: float64(value), Status: Present} case float64: diff --git a/pgtype/float8_array.go b/pgtype/float8_array.go index b2f70f51..811c5a1f 100644 --- a/pgtype/float8_array.go +++ b/pgtype/float8_array.go @@ -17,8 +17,6 @@ type Float8Array struct { func (dst *Float8Array) Set(src interface{}) error { switch value := src.(type) { - case Float8Array: - *dst = value case []float64: if value == nil { diff --git a/pgtype/inet.go b/pgtype/inet.go index 00bfb30c..87d675f9 100644 --- a/pgtype/inet.go +++ b/pgtype/inet.go @@ -25,8 +25,6 @@ type Inet struct { func (dst *Inet) Set(src interface{}) error { switch value := src.(type) { - case Inet: - *dst = value case net.IPNet: *dst = Inet{IPNet: &value, Status: Present} case *net.IPNet: diff --git a/pgtype/inet_array.go b/pgtype/inet_array.go index 4d865b4f..1d1cf3fd 100644 --- a/pgtype/inet_array.go +++ b/pgtype/inet_array.go @@ -18,8 +18,6 @@ type InetArray struct { func (dst *InetArray) Set(src interface{}) error { switch value := src.(type) { - case InetArray: - *dst = value case []*net.IPNet: if value == nil { diff --git a/pgtype/inet_test.go b/pgtype/inet_test.go index 90b0723f..16035fca 100644 --- a/pgtype/inet_test.go +++ b/pgtype/inet_test.go @@ -31,7 +31,6 @@ func TestInetSet(t *testing.T) { source interface{} result pgtype.Inet }{ - {source: pgtype.Inet{IPNet: mustParseCidr(t, "127.0.0.1/32"), Status: pgtype.Null}, result: pgtype.Inet{IPNet: mustParseCidr(t, "127.0.0.1/32"), Status: pgtype.Null}}, {source: mustParseCidr(t, "127.0.0.1/32"), result: pgtype.Inet{IPNet: mustParseCidr(t, "127.0.0.1/32"), Status: pgtype.Present}}, {source: mustParseCidr(t, "127.0.0.1/32").IP, result: pgtype.Inet{IPNet: mustParseCidr(t, "127.0.0.1/32"), Status: pgtype.Present}}, {source: "127.0.0.1/32", result: pgtype.Inet{IPNet: mustParseCidr(t, "127.0.0.1/32"), Status: pgtype.Present}}, diff --git a/pgtype/int2.go b/pgtype/int2.go index 525427c5..62e1bc69 100644 --- a/pgtype/int2.go +++ b/pgtype/int2.go @@ -17,8 +17,6 @@ type Int2 struct { func (dst *Int2) Set(src interface{}) error { switch value := src.(type) { - case Int2: - *dst = value case int8: *dst = Int2{Int: int16(value), Status: Present} case uint8: diff --git a/pgtype/int2_array.go b/pgtype/int2_array.go index 28792fa5..3d06c018 100644 --- a/pgtype/int2_array.go +++ b/pgtype/int2_array.go @@ -17,8 +17,6 @@ type Int2Array struct { func (dst *Int2Array) Set(src interface{}) error { switch value := src.(type) { - case Int2Array: - *dst = value case []int16: if value == nil { diff --git a/pgtype/int4.go b/pgtype/int4.go index b3203a28..8eaf5094 100644 --- a/pgtype/int4.go +++ b/pgtype/int4.go @@ -17,8 +17,6 @@ type Int4 struct { func (dst *Int4) Set(src interface{}) error { switch value := src.(type) { - case Int4: - *dst = value case int8: *dst = Int4{Int: int32(value), Status: Present} case uint8: diff --git a/pgtype/int4_array.go b/pgtype/int4_array.go index 61cedb2e..5cd91c04 100644 --- a/pgtype/int4_array.go +++ b/pgtype/int4_array.go @@ -17,8 +17,6 @@ type Int4Array struct { func (dst *Int4Array) Set(src interface{}) error { switch value := src.(type) { - case Int4Array: - *dst = value case []int32: if value == nil { diff --git a/pgtype/int8.go b/pgtype/int8.go index 15ad6715..2416500d 100644 --- a/pgtype/int8.go +++ b/pgtype/int8.go @@ -17,8 +17,6 @@ type Int8 struct { func (dst *Int8) Set(src interface{}) error { switch value := src.(type) { - case Int8: - *dst = value case int8: *dst = Int8{Int: int64(value), Status: Present} case uint8: diff --git a/pgtype/int8_array.go b/pgtype/int8_array.go index 9f4373e8..5efc0f45 100644 --- a/pgtype/int8_array.go +++ b/pgtype/int8_array.go @@ -17,8 +17,6 @@ type Int8Array struct { func (dst *Int8Array) Set(src interface{}) error { switch value := src.(type) { - case Int8Array: - *dst = value case []int64: if value == nil { diff --git a/pgtype/qchar.go b/pgtype/qchar.go index b6392cf9..d46e716d 100644 --- a/pgtype/qchar.go +++ b/pgtype/qchar.go @@ -25,8 +25,6 @@ type QChar struct { func (dst *QChar) Set(src interface{}) error { switch value := src.(type) { - case QChar: - *dst = value case int8: *dst = QChar{Int: value, Status: Present} case uint8: diff --git a/pgtype/text.go b/pgtype/text.go index 50db2349..3dd082c9 100644 --- a/pgtype/text.go +++ b/pgtype/text.go @@ -13,8 +13,6 @@ type Text struct { func (dst *Text) Set(src interface{}) error { switch value := src.(type) { - case Text: - *dst = value case string: *dst = Text{String: value, Status: Present} case *string: diff --git a/pgtype/text_array.go b/pgtype/text_array.go index 3a5a64ce..1e6677a9 100644 --- a/pgtype/text_array.go +++ b/pgtype/text_array.go @@ -17,8 +17,6 @@ type TextArray struct { func (dst *TextArray) Set(src interface{}) error { switch value := src.(type) { - case TextArray: - *dst = value case []string: if value == nil { diff --git a/pgtype/text_test.go b/pgtype/text_test.go index f5e20055..39348bcc 100644 --- a/pgtype/text_test.go +++ b/pgtype/text_test.go @@ -22,7 +22,6 @@ func TestTextSet(t *testing.T) { source interface{} result pgtype.Text }{ - {source: pgtype.Text{String: "foo", Status: pgtype.Present}, result: pgtype.Text{String: "foo", Status: pgtype.Present}}, {source: "foo", result: pgtype.Text{String: "foo", Status: pgtype.Present}}, {source: _string("bar"), result: pgtype.Text{String: "bar", Status: pgtype.Present}}, {source: (*string)(nil), result: pgtype.Text{Status: pgtype.Null}}, diff --git a/pgtype/timestamp.go b/pgtype/timestamp.go index a84f3881..3bb8f080 100644 --- a/pgtype/timestamp.go +++ b/pgtype/timestamp.go @@ -27,8 +27,6 @@ type Timestamp struct { // time.Time in a non-UTC time zone, the time zone is discarded. func (dst *Timestamp) Set(src interface{}) error { switch value := src.(type) { - case Timestamp: - *dst = value case time.Time: *dst = Timestamp{Time: time.Date(value.Year(), value.Month(), value.Day(), value.Hour(), value.Minute(), value.Second(), value.Nanosecond(), time.UTC), Status: Present} default: diff --git a/pgtype/timestamp_array.go b/pgtype/timestamp_array.go index ec0facb2..c955dc42 100644 --- a/pgtype/timestamp_array.go +++ b/pgtype/timestamp_array.go @@ -18,8 +18,6 @@ type TimestampArray struct { func (dst *TimestampArray) Set(src interface{}) error { switch value := src.(type) { - case TimestampArray: - *dst = value case []time.Time: if value == nil { diff --git a/pgtype/timestamp_test.go b/pgtype/timestamp_test.go index 7297ed1f..58828806 100644 --- a/pgtype/timestamp_test.go +++ b/pgtype/timestamp_test.go @@ -38,7 +38,6 @@ func TestTimestampSet(t *testing.T) { source interface{} result pgtype.Timestamp }{ - {source: pgtype.Timestamp{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}, result: pgtype.Timestamp{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, {source: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), result: pgtype.Timestamp{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, {source: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC), result: pgtype.Timestamp{Time: time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC), Status: pgtype.Present}}, {source: time.Date(1999, 12, 31, 12, 59, 59, 0, time.UTC), result: pgtype.Timestamp{Time: time.Date(1999, 12, 31, 12, 59, 59, 0, time.UTC), Status: pgtype.Present}}, diff --git a/pgtype/timestamptz.go b/pgtype/timestamptz.go index a6922d5b..5b9f5038 100644 --- a/pgtype/timestamptz.go +++ b/pgtype/timestamptz.go @@ -28,8 +28,6 @@ type Timestamptz struct { func (dst *Timestamptz) Set(src interface{}) error { switch value := src.(type) { - case Timestamptz: - *dst = value case time.Time: *dst = Timestamptz{Time: value, Status: Present} default: diff --git a/pgtype/timestamptz_array.go b/pgtype/timestamptz_array.go index 775ec970..cd63e02e 100644 --- a/pgtype/timestamptz_array.go +++ b/pgtype/timestamptz_array.go @@ -18,8 +18,6 @@ type TimestamptzArray struct { func (dst *TimestamptzArray) Set(src interface{}) error { switch value := src.(type) { - case TimestamptzArray: - *dst = value case []time.Time: if value == nil { diff --git a/pgtype/timestamptz_test.go b/pgtype/timestamptz_test.go index 242cd05f..6ddfc1bc 100644 --- a/pgtype/timestamptz_test.go +++ b/pgtype/timestamptz_test.go @@ -38,7 +38,6 @@ func TestTimestamptzSet(t *testing.T) { source interface{} result pgtype.Timestamptz }{ - {source: pgtype.Timestamptz{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.Local), Status: pgtype.Present}, result: pgtype.Timestamptz{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.Local), Status: pgtype.Present}}, {source: time.Date(1900, 1, 1, 0, 0, 0, 0, time.Local), result: pgtype.Timestamptz{Time: time.Date(1900, 1, 1, 0, 0, 0, 0, time.Local), Status: pgtype.Present}}, {source: time.Date(1970, 1, 1, 0, 0, 0, 0, time.Local), result: pgtype.Timestamptz{Time: time.Date(1970, 1, 1, 0, 0, 0, 0, time.Local), Status: pgtype.Present}}, {source: time.Date(1999, 12, 31, 12, 59, 59, 0, time.Local), result: pgtype.Timestamptz{Time: time.Date(1999, 12, 31, 12, 59, 59, 0, time.Local), Status: pgtype.Present}}, diff --git a/pgtype/typed_array.go.erb b/pgtype/typed_array.go.erb index c62e2896..a56097c0 100644 --- a/pgtype/typed_array.go.erb +++ b/pgtype/typed_array.go.erb @@ -16,8 +16,6 @@ type <%= pgtype_array_type %> struct { func (dst *<%= pgtype_array_type %>) Set(src interface{}) error { switch value := src.(type) { - case <%= pgtype_array_type %>: - *dst = value <% go_array_types.split(",").each do |t| %> case <%= t %>: if value == nil {