1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- 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("是否可以添加好友(与属主账号非好友且其数据查询正常时 0 不可以,1 可以)"),
- 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"},
- }
- }
|