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" "time" ) // AddWechatFriendLog holds the schema definition for the AddWechatFriendLog entity. type AddWechatFriendLog struct { ent.Schema } // Fields of the AddWechatFriendLog. func (AddWechatFriendLog) Fields() []ent.Field { return []ent.Field{ field.Int64("id"). Comment("主键id"). Unique(). Immutable(), field.String("owner_wx_id"). Default(""). NotEmpty(). MaxLen(64). Comment("属主的wxid"), field.Int("owner_wx_type"). Default(1). Comment("属主的微信类型(1个微,2企微)"), field.String("find_content"). Default(""). NotEmpty(). MaxLen(64). Comment("手机号"), field.String("message"). Default(""). NotEmpty(). MaxLen(255). Comment("添加好友时候填写的申请消息"), field.JSON("find_request", map[string]interface{}{}). Optional(). Comment("发起查询数据的时候json"), field.JSON("find_result", map[string]interface{}{}). Optional(). Comment("查询返回结果"), field.Int("is_can_add"). Default(0). Comment("任务执行次数"), field.Int("task_count"). Default(0). Comment("是否可以添加好友(与属主账号非好友且其数据查询正常时 0 不可以,1 可以 2成功添加申请)"), field.Int64("task_id").Default(0).Comment("添加时候的请求体"), field.JSON("add_request", map[string]interface{}{}). Optional().Comment("添加时候的请求体"), field.JSON("add_result", map[string]interface{}{}). Optional().Comment("添加请求的结果"), field.Int64("created_at"). DefaultFunc(func() int64 { return time.Now().Unix() }).Comment("创建时间戳"), field.Int64("updated_at"). DefaultFunc(func() int64 { return time.Now().Unix() }). UpdateDefault(func() int64 { return time.Now().Unix() }).Comment("修改时间戳"), } } // Indexes of the AddWechatFriendLog. func (AddWechatFriendLog) Indexes() []ent.Index { return []ent.Index{ index.Fields("owner_wx_id", "is_can_add"), } } func (AddWechatFriendLog) Annotations() []schema.Annotation { return []schema.Annotation{ schema.Comment("微信添加好友记录"), entsql.Annotation{Table: "add_wechat_friend_log"}, } }