Skip to content

Commit 65ae4eb

Browse files
committed
refactor: Remove GormDataType interface implementation
1 parent be0b05d commit 65ae4eb

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

type_bench_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,6 @@ func BenchmarkBuiltinType_String(b *testing.B) {
120120
}
121121
}
122122

123-
func BenchmarkBuiltinType_GormDataType(b *testing.B) {
124-
t := NewDateTime(Now())
125-
b.ResetTimer()
126-
for n := 0; n < b.N; n++ {
127-
_ = t.GormDataType()
128-
}
129-
}
130-
131123
func BenchmarkCustomerType_Scan(b *testing.B) {
132124
t := NewFormatType[iso8601Type](Parse("2020-08-05"))
133125
b.ResetTimer()
@@ -180,11 +172,3 @@ func BenchmarkCustomerType_String(b *testing.B) {
180172
_ = t.String()
181173
}
182174
}
183-
184-
func BenchmarkCustomerType_GormDataType(b *testing.B) {
185-
t := NewFormatType[iso8601Type](Parse("2020-08-05"))
186-
b.ResetTimer()
187-
for n := 0; n < b.N; n++ {
188-
_ = t.GormDataType()
189-
}
190-
}

type_unit_test.go

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,6 @@ func (s *CarbonTypeSuite) TestCarbonType_UnmarshalJSON() {
172172
})
173173
}
174174

175-
func (s *CarbonTypeSuite) TestCarbonType_GormDataType() {
176-
var model carbonTypeModel
177-
178-
s.Equal("datetime", model.Carbon1.GormDataType())
179-
s.Equal("datetime", model.Carbon2.GormDataType())
180-
}
181-
182175
type builtinTypeModel struct {
183176
Date Date `json:"date"`
184177
DateMilli DateMilli `json:"date_milli"`
@@ -752,40 +745,8 @@ func (s *BuiltinTypeSuite) TestBuiltinType_UnmarshalJSON() {
752745
})
753746
}
754747

755-
func (s *BuiltinTypeSuite) TestBuiltinType_GormDataType() {
756-
var model builtinTypeModel
757-
758-
s.Equal("date", model.Date.GormDataType())
759-
s.Equal("datetime(6)", model.DateMilli.GormDataType())
760-
s.Equal("datetime(6)", model.DateMicro.GormDataType())
761-
s.Equal("datetime(6)", model.DateNano.GormDataType())
762-
763-
s.Equal("time", model.Time.GormDataType())
764-
s.Equal("datetime(6)", model.TimeMilli.GormDataType())
765-
s.Equal("datetime(6)", model.TimeMicro.GormDataType())
766-
s.Equal("datetime(6)", model.TimeNano.GormDataType())
767-
768-
s.Equal("datetime", model.DateTime.GormDataType())
769-
s.Equal("datetime(6)", model.DateTimeMilli.GormDataType())
770-
s.Equal("datetime(6)", model.DateTimeMicro.GormDataType())
771-
s.Equal("datetime(6)", model.DateTimeNano.GormDataType())
772-
773-
s.Equal("timestamp", model.Timestamp.GormDataType())
774-
s.Equal("timestamp(6)", model.TimestampMilli.GormDataType())
775-
s.Equal("timestamp(6)", model.TimestampMicro.GormDataType())
776-
s.Equal("timestamp(6)", model.TimestampNano.GormDataType())
777-
778-
s.Equal("datetime", model.CreatedAt.GormDataType())
779-
s.Equal("datetime", model.UpdatedAt.GormDataType())
780-
s.Equal("timestamp", model.DeletedAt.GormDataType())
781-
s.Equal("timestamp", model.DeletedAt.GormDataType())
782-
}
783-
784748
type rfc3339Type string
785749

786-
func (t rfc3339Type) DataType() string {
787-
return "datetime"
788-
}
789750
func (t rfc3339Type) Layout() string {
790751
return RFC3339Layout
791752
}
@@ -798,9 +759,6 @@ func (w3cType) Layout() string {
798759

799760
type iso8601Type string
800761

801-
func (t iso8601Type) DataType() string {
802-
return "datetime"
803-
}
804762
func (t iso8601Type) Format() string {
805763
return ISO8601Format
806764
}
@@ -1152,14 +1110,3 @@ func (s *CustomerTypeSuite) TestCustomerType_UnmarshalJSON() {
11521110
s.Equal("2020-08-05T13:14:15Z", model.UpdatedAt.String())
11531111
})
11541112
}
1155-
1156-
func (s *CustomerTypeSuite) TestCustomerType_GormDataType() {
1157-
var model CustomerTypeModel
1158-
1159-
s.Equal("datetime", model.Customer1.GormDataType())
1160-
s.Equal("datetime", model.Customer2.GormDataType())
1161-
s.Equal("datetime", model.Customer3.GormDataType())
1162-
s.Equal("datetime", model.Customer4.GormDataType())
1163-
s.Equal("datetime", model.CreatedAt.GormDataType())
1164-
s.Equal("datetime", model.UpdatedAt.GormDataType())
1165-
}

0 commit comments

Comments
 (0)