wp_chatroom.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. "entgo.io/ent/schema/index"
  8. "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
  9. )
  10. type WpChatroom struct {
  11. ent.Schema
  12. }
  13. func (WpChatroom) Fields() []ent.Field {
  14. return []ent.Field{
  15. field.String("wx_wxid").Default("").
  16. Default("").
  17. Annotations(entsql.WithComments(true)).
  18. Comment("所属微信id"),
  19. field.String("chatroom_id").Default("").
  20. Annotations(entsql.WithComments(true)).
  21. Comment("群id"),
  22. field.String("nickname").Default("").
  23. Annotations(entsql.WithComments(true)).
  24. Comment("群昵称"),
  25. field.String("owner").Default("").
  26. Annotations(entsql.WithComments(true)).
  27. Comment("群主"),
  28. field.String("avatar").Default("").
  29. Annotations(entsql.WithComments(true)).
  30. Comment("群头像"),
  31. field.JSON("member_list", []string{}).
  32. Annotations(entsql.WithComments(true)).
  33. Comment("群成员"),
  34. }
  35. }
  36. func (WpChatroom) Mixin() []ent.Mixin {
  37. return []ent.Mixin{
  38. mixins.IDMixin{},
  39. mixins.StatusMixin{},
  40. }
  41. }
  42. func (WpChatroom) Indexes() []ent.Index {
  43. return []ent.Index{
  44. index.Fields("wx_wxid", "chatroom_id"),
  45. }
  46. }
  47. func (WpChatroom) Edges() []ent.Edge { return []ent.Edge{} }
  48. func (WpChatroom) Annotations() []schema.Annotation {
  49. return []schema.Annotation{
  50. entsql.WithComments(true),
  51. entsql.Annotation{Table: "wp_chatroom"},
  52. }
  53. }