✨ add i18n support
This commit is contained in:
31
common/ent/schema/mixin/default_mixin.go
Normal file
31
common/ent/schema/mixin/default_mixin.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package mixin
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/mixin"
|
||||
)
|
||||
|
||||
type DefaultMixin struct {
|
||||
mixin.Schema
|
||||
}
|
||||
|
||||
func (DefaultMixin) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Immutable().
|
||||
Default(time.Now).
|
||||
Comment("创建时间"),
|
||||
field.Time("updated_at").
|
||||
Default(time.Now).
|
||||
Comment("更新时间").
|
||||
UpdateDefault(time.Now),
|
||||
field.Int8("deleted").
|
||||
Default(0).
|
||||
Max(1).
|
||||
Optional().
|
||||
Comment("是否删除 0 未删除 1 已删除"),
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user