label_tagging.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package schema
  2. import (
  3. "entgo.io/ent"
  4. "entgo.io/ent/dialect/entsql"
  5. "entgo.io/ent/schema"
  6. "entgo.io/ent/schema/field"
  7. "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
  8. "wechat-api/ent/schema/localmixin"
  9. )
  10. type LabelTagging struct {
  11. ent.Schema
  12. }
  13. func (LabelTagging) Fields() []ent.Field {
  14. return []ent.Field{
  15. field.Uint64("label_id").Default(1).
  16. Annotations(entsql.WithComments(true)).
  17. Comment("标签 ID"),
  18. field.Uint64("contact_id").Default(1).
  19. Annotations(entsql.WithComments(true)).
  20. Comment("联系人 ID"),
  21. field.Uint64("organization_id").Optional().Default(1).
  22. Comment("机构 ID").
  23. Annotations(entsql.WithComments(true)),
  24. }
  25. }
  26. func (LabelTagging) Mixin() []ent.Mixin {
  27. return []ent.Mixin{
  28. mixins.IDMixin{},
  29. mixins.StatusMixin{},
  30. localmixin.SoftDeleteMixin{},
  31. }
  32. }
  33. func (LabelTagging) Indexes() []ent.Index {
  34. return []ent.Index{}
  35. }
  36. func (LabelTagging) Edges() []ent.Edge {
  37. return nil
  38. }
  39. func (LabelTagging) Annotations() []schema.Annotation {
  40. return []schema.Annotation{
  41. entsql.WithComments(true),
  42. entsql.Annotation{Table: "label_tagging"},
  43. }
  44. }