package mixins import ( "entgo.io/ent" "entgo.io/ent/dialect" "entgo.io/ent/schema/field" "entgo.io/ent/schema/mixin" "git.noahlan.cn/noahlan/ntool-biz/core/orm/nent/types" ) // StatusMixin implements the ent.Mixin for sharing // status fields with package schemas. type StatusMixin struct { // We embed the `mixin.Schema` to avoid // implementing the rest of the methods. mixin.Schema } func (StatusMixin) Fields() []ent.Field { return []ent.Field{ field.Enum("status"). Default(string(types.StatusNormal)). SchemaType(map[string]string{ dialect.MySQL: "varchar(32)", }). GoType(types.Status("")). Comment("Status | 状态"), } }