feat: ent mixin.

This commit is contained in:
tx7do
2023-11-01 18:23:12 +08:00
parent 836f4e2461
commit b27c96f932
4 changed files with 92 additions and 1 deletions

21
entgo/mixin/creator_id.go Normal file
View File

@@ -0,0 +1,21 @@
package mixin
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
_mixin "entgo.io/ent/schema/mixin"
)
type CreatorId struct {
_mixin.Schema
}
func (CreatorId) Fields() []ent.Field {
return []ent.Field{
field.Uint64("creator_id").
Comment("创建者用户ID").
Immutable().
Optional().
Nillable(),
}
}