Skip to content

Commit

Permalink
Implement GormDataType interface
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Apr 18, 2024
1 parent 3c9ef67 commit 93cc1e6
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion database_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,42 @@ func TestError_Value(t *testing.T) {
}

func TestCarbon_GormDataType(t *testing.T) {
assert.Equal(t, "time", NewCarbon().GormDataType())
var carbon Carbon
assert.Equal(t, "time", carbon.GormDataType())

var dateTime DateTime
assert.Equal(t, "time", dateTime.GormDataType())
var dateTimeMilli DateTimeMilli
assert.Equal(t, "time", dateTimeMilli.GormDataType())
var dateTimeMicro DateTimeMicro
assert.Equal(t, "time", dateTimeMicro.GormDataType())
var dateTimeNano DateTimeNano
assert.Equal(t, "time", dateTimeNano.GormDataType())

var date Date
assert.Equal(t, "time", date.GormDataType())
var dateMilli DateMilli
assert.Equal(t, "time", dateMilli.GormDataType())
var dateMicro DateMicro
assert.Equal(t, "time", dateMicro.GormDataType())
var dateNano DateNano
assert.Equal(t, "time", dateNano.GormDataType())

var time Time
assert.Equal(t, "time", time.GormDataType())
var timeMilli TimeMilli
assert.Equal(t, "time", timeMilli.GormDataType())
var timeMicro TimeMicro
assert.Equal(t, "time", timeMicro.GormDataType())
var timeNano TimeNano
assert.Equal(t, "time", timeNano.GormDataType())

var timestamp Timestamp
assert.Equal(t, "int", timestamp.GormDataType())
var timestampMilli TimestampMilli
assert.Equal(t, "int", timestampMilli.GormDataType())
var timestampMicro TimestampMicro
assert.Equal(t, "int", timestampMicro.GormDataType())
var timestampNano TimestampNano
assert.Equal(t, "int", timestampNano.GormDataType())
}

0 comments on commit 93cc1e6

Please sign in to comment.