wx_card_user.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package schema
  2. import (
  3. "wechat-api/ent/schema/localmixin"
  4. "entgo.io/ent"
  5. "entgo.io/ent/dialect/entsql"
  6. "entgo.io/ent/schema"
  7. "entgo.io/ent/schema/field"
  8. "entgo.io/ent/schema/index"
  9. "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
  10. )
  11. type WxCardUser struct {
  12. ent.Schema
  13. }
  14. func (WxCardUser) Fields() []ent.Field {
  15. return []ent.Field{
  16. field.String("wxid").Default("").Default("").Comment("微信id"),
  17. field.String("account").Default("").Comment("微信号"),
  18. field.String("avatar").Default("").Comment("头像"),
  19. field.String("nickname").Default("").Comment("昵称"),
  20. field.String("remark").Default("").Comment("备注名"),
  21. field.String("phone").Default("").Comment("手机号"),
  22. field.String("open_id").Default("").Comment("OpenID"),
  23. field.String("union_id").Default("").Comment("UnionID"),
  24. field.String("session_key").Default("").Comment("SessionKey"),
  25. }
  26. }
  27. func (WxCardUser) Mixin() []ent.Mixin {
  28. return []ent.Mixin{
  29. mixins.IDMixin{},
  30. localmixin.SoftDeleteMixin{},
  31. }
  32. }
  33. func (WxCardUser) Indexes() []ent.Index {
  34. return []ent.Index{
  35. index.Fields("wxid", "open_id"),
  36. }
  37. }
  38. func (WxCardUser) Edges() []ent.Edge {
  39. return nil
  40. }
  41. func (WxCardUser) Annotations() []schema.Annotation {
  42. return []schema.Annotation{
  43. entsql.WithComments(true),
  44. entsql.Annotation{Table: "wx_card_user"},
  45. }
  46. }