compapi_job.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package schema
  2. import (
  3. "wechat-api/ent/custom_types"
  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. // CompapiJob holds the schema definition for the CompapiJob entity.
  12. type CompapiJob struct {
  13. ent.Schema
  14. }
  15. // Fields of the CompapiJob.
  16. func (CompapiJob) Fields() []ent.Field {
  17. return []ent.Field{
  18. field.Time("dist_at").Optional().Annotations(entsql.WithComments(true)).Comment("Dist Time | 分发时间"),
  19. field.Int8("dist_status").Optional().Default(0).Annotations(entsql.WithComments(true)).Comment("dist status | 分发状态 0 未 1 已"),
  20. field.Int8("callback_status").Optional().Default(10).Annotations(entsql.WithComments(true)).Comment("callback_status | 回调状态 10 准备回调 20 "),
  21. field.String("callback_url").Annotations(entsql.WithComments(true)).Comment("异步执行回调地址"),
  22. field.JSON("request_json", custom_types.OriginalData{}).Annotations(entsql.WithComments(true)).Comment("请求参数结构JSON"),
  23. field.String("auth_token").Default("").Annotations(entsql.WithComments(true)).Comment("发起请求者的授权token"),
  24. field.String("event_type").Default("").Annotations(entsql.WithComments(true)).Comment("发起请求者的类型"),
  25. field.Int8("workid_idx").Optional().Default(0).Annotations(entsql.WithComments(true)).Comment("workId在字典中的索引"),
  26. field.String("chat_id").Optional().Default("").Annotations(entsql.WithComments(true)).Comment("会话ID"),
  27. field.Int8("retry_count").Optional().Default(0).Annotations(entsql.WithComments(true)).Comment("retry count | 重试次数"),
  28. }
  29. }
  30. func (CompapiJob) Mixin() []ent.Mixin {
  31. return []ent.Mixin{
  32. mixins.IDMixin{},
  33. }
  34. }
  35. func (CompapiJob) Indexes() []ent.Index {
  36. return []ent.Index{
  37. index.Fields("dist_status"),
  38. index.Fields("callback_status"),
  39. }
  40. }
  41. func (CompapiJob) Edges() []ent.Edge { return []ent.Edge{} }
  42. func (CompapiJob) Annotations() []schema.Annotation {
  43. return []schema.Annotation{
  44. entsql.WithComments(true),
  45. entsql.Annotation{Table: "compapi_job"},
  46. }
  47. }