message.go 908 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. )
  8. // Message holds the schema definition for the Message entity.
  9. type Message struct {
  10. ent.Schema
  11. }
  12. // Fields of the Message.
  13. func (Message) Fields() []ent.Field {
  14. return []ent.Field{
  15. field.String("wx_wxid").Optional().Default("").
  16. Annotations(entsql.WithComments(true)).
  17. Comment("属主微信id"),
  18. field.String("wxid").Default("").
  19. Annotations(entsql.WithComments(true)).
  20. Comment("微信id 公众号微信ID"),
  21. field.String("content").Default("").
  22. Annotations(entsql.WithComments(true)).
  23. Comment("微信消息内容"),
  24. }
  25. }
  26. // Edges of the Message.
  27. func (Message) Edges() []ent.Edge {
  28. return nil
  29. }
  30. func (Message) Annotations() []schema.Annotation {
  31. return []schema.Annotation{
  32. entsql.WithComments(true),
  33. entsql.Annotation{Table: "messages"},
  34. }
  35. }