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" "github.com/suyuan32/simple-admin-common/orm/ent/mixins" "wechat-api/ent/schema/localmixin" ) type ChatSession struct { ent.Schema } func (ChatSession) Fields() []ent.Field { return []ent.Field{ field.String("name").Default("").Comment("名称"), field.Uint64("user_id").Default(0).Comment("用户ID"), field.Uint64("bot_id").Default(0).Comment("聊天ID"), field.Uint8("bot_type").Default(2).Comment("类型:1-微信 2-小程序card 3-智能体"), } } func (ChatSession) Mixin() []ent.Mixin { return []ent.Mixin{ mixins.IDMixin{}, localmixin.SoftDeleteMixin{}, } } func (ChatSession) Indexes() []ent.Index { return []ent.Index{ index.Fields("user_id", "bot_id", "bot_type"), } } func (ChatSession) Edges() []ent.Edge { return nil } func (ChatSession) Annotations() []schema.Annotation { return []schema.Annotation{ entsql.WithComments(true), entsql.Annotation{Table: "chat_session"}, } }