You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default filed was partially implement in Hooks #71 , fields CreateAt and UpdateAt can update as default fields by insert field.DefaultField in document struct:
field.DefaultField `bson:",inline"`
Custom field was partially implement in Hooks #71 too, user can define their custom fields about create and update time, with type time.Time or int64. You can check examples here:
func (u *UserHook) CustomFields() field.CustomFieldsBuilder {
return field.NewCustom().SetCreateAt("CreateTimeAt").SetUpdateAt("UpdateTimeAt")
}
But, function about default or custom fields only work in insert operation (InsertOne/InsertMany). 😢
More job need to do in update operation.
jiangz222
changed the title
Create and update some fields as default
Support default fields and custom fields
Aug 31, 2020
Fields like
CreateAt
andUpdateAt
, user doesn't need to operate those fileds when doinsert
orupdate
operationUser can define their custom fields about create and update time, like
Create_At
,Update_At
with different type liketime.Time
orint64
The text was updated successfully, but these errors were encountered: