mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +03:00
ent/field: add update_default option time field
Reviewed By: alexsn Differential Revision: D17070907 fbshipit-source-id: 63c9ce75c58e524044c38f9461cb04e8e45c8017
This commit is contained in:
committed by
Facebook Github Bot
parent
bd07c86b60
commit
772b8a33f8
@@ -100,6 +100,14 @@ func TestTime(t *testing.T) {
|
||||
assert.Equal(t, "time.Time", fd.Type.String())
|
||||
assert.NotNil(t, fd.Default)
|
||||
assert.Equal(t, now, fd.Default.(func() time.Time)())
|
||||
|
||||
fd = field.Time("updated_at").
|
||||
UpdateDefault(func() time.Time {
|
||||
return now
|
||||
}).
|
||||
Descriptor()
|
||||
assert.Equal(t, "updated_at", fd.Name)
|
||||
assert.Equal(t, now, fd.UpdateDefault.(func() time.Time)())
|
||||
}
|
||||
|
||||
func TestField_Tag(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user