package schema import ( "entgo.io/ent" "entgo.io/ent/dialect/entsql" "entgo.io/ent/schema" "entgo.io/ent/schema/field" "entgo.io/ent/schema/index" ) type Msg struct { ent.Schema } func (Msg) Fields() []ent.Field { return []ent.Field{ field.Int("id"), field.Time("created_at").Comment("Create Time | 创建日期"), field.Time("updated_at").Comment("Update Time | 修改日期"), field.Time("deleted_at").Optional().Comment("Delete Time | 删除日期"), field.Uint8("status").Optional().Comment("Status 1: normal 2: ban | 状态 1 正常 2 禁用"), field.String("fromwxid").Optional().Comment("发送方微信ID"), field.String("toid").Optional().Comment("接收人微信ID/群ID"), field.Int32("msgtype").Optional().Comment("消息类型"), field.String("msg").Optional().Comment("消息"), field.String("batch_no").Optional().Comment("批次号")} } func (Msg) Edges() []ent.Edge { return nil } func (Msg) Indexes() []ent.Index { return []ent.Index{ index.Fields("batch_no"), index.Fields("id"), index.Fields("status")} } func (Msg) Annotations() []schema.Annotation { return []schema.Annotation{ entsql.WithComments(true), entsql.Annotation{Table: "msg"}, } }