Prechádzať zdrojové kódy

增加群加好友功能,并修复SOP节点更新问题

boweniac 3 mesiacov pred
rodič
commit
af5aa514fa

+ 290 - 6
ent/client.go

@@ -35,6 +35,8 @@ import (
 	"wechat-api/ent/usagedetail"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
 	"wechat-api/ent/wx"
 	"wechat-api/ent/wxcard"
 	"wechat-api/ent/wxcarduser"
@@ -101,6 +103,10 @@ type Client struct {
 	UsageTotal *UsageTotalClient
 	// WorkExperience is the client for interacting with the WorkExperience builders.
 	WorkExperience *WorkExperienceClient
+	// WpChatroom is the client for interacting with the WpChatroom builders.
+	WpChatroom *WpChatroomClient
+	// WpChatroomMember is the client for interacting with the WpChatroomMember builders.
+	WpChatroomMember *WpChatroomMemberClient
 	// Wx is the client for interacting with the Wx builders.
 	Wx *WxClient
 	// WxCard is the client for interacting with the WxCard builders.
@@ -144,6 +150,8 @@ func (c *Client) init() {
 	c.UsageDetail = NewUsageDetailClient(c.config)
 	c.UsageTotal = NewUsageTotalClient(c.config)
 	c.WorkExperience = NewWorkExperienceClient(c.config)
+	c.WpChatroom = NewWpChatroomClient(c.config)
+	c.WpChatroomMember = NewWpChatroomMemberClient(c.config)
 	c.Wx = NewWxClient(c.config)
 	c.WxCard = NewWxCardClient(c.config)
 	c.WxCardUser = NewWxCardUserClient(c.config)
@@ -264,6 +272,8 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
 		UsageDetail:       NewUsageDetailClient(cfg),
 		UsageTotal:        NewUsageTotalClient(cfg),
 		WorkExperience:    NewWorkExperienceClient(cfg),
+		WpChatroom:        NewWpChatroomClient(cfg),
+		WpChatroomMember:  NewWpChatroomMemberClient(cfg),
 		Wx:                NewWxClient(cfg),
 		WxCard:            NewWxCardClient(cfg),
 		WxCardUser:        NewWxCardUserClient(cfg),
@@ -311,6 +321,8 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
 		UsageDetail:       NewUsageDetailClient(cfg),
 		UsageTotal:        NewUsageTotalClient(cfg),
 		WorkExperience:    NewWorkExperienceClient(cfg),
+		WpChatroom:        NewWpChatroomClient(cfg),
+		WpChatroomMember:  NewWpChatroomMemberClient(cfg),
 		Wx:                NewWxClient(cfg),
 		WxCard:            NewWxCardClient(cfg),
 		WxCardUser:        NewWxCardUserClient(cfg),
@@ -348,7 +360,8 @@ func (c *Client) Use(hooks ...Hook) {
 		c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
 		c.LabelRelationship, c.Message, c.MessageRecords, c.Msg, c.Server, c.SopNode,
 		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageTotal,
-		c.WorkExperience, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
+		c.WorkExperience, c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard,
+		c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Use(hooks...)
 	}
@@ -362,7 +375,8 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
 		c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
 		c.LabelRelationship, c.Message, c.MessageRecords, c.Msg, c.Server, c.SopNode,
 		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageTotal,
-		c.WorkExperience, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
+		c.WorkExperience, c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard,
+		c.WxCardUser, c.WxCardVisit,
 	} {
 		n.Intercept(interceptors...)
 	}
@@ -419,6 +433,10 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
 		return c.UsageTotal.mutate(ctx, m)
 	case *WorkExperienceMutation:
 		return c.WorkExperience.mutate(ctx, m)
+	case *WpChatroomMutation:
+		return c.WpChatroom.mutate(ctx, m)
+	case *WpChatroomMemberMutation:
+		return c.WpChatroomMember.mutate(ctx, m)
 	case *WxMutation:
 		return c.Wx.mutate(ctx, m)
 	case *WxCardMutation:
@@ -4028,6 +4046,272 @@ func (c *WorkExperienceClient) mutate(ctx context.Context, m *WorkExperienceMuta
 	}
 }
 
+// WpChatroomClient is a client for the WpChatroom schema.
+type WpChatroomClient struct {
+	config
+}
+
+// NewWpChatroomClient returns a client for the WpChatroom from the given config.
+func NewWpChatroomClient(c config) *WpChatroomClient {
+	return &WpChatroomClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `wpchatroom.Hooks(f(g(h())))`.
+func (c *WpChatroomClient) Use(hooks ...Hook) {
+	c.hooks.WpChatroom = append(c.hooks.WpChatroom, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `wpchatroom.Intercept(f(g(h())))`.
+func (c *WpChatroomClient) Intercept(interceptors ...Interceptor) {
+	c.inters.WpChatroom = append(c.inters.WpChatroom, interceptors...)
+}
+
+// Create returns a builder for creating a WpChatroom entity.
+func (c *WpChatroomClient) Create() *WpChatroomCreate {
+	mutation := newWpChatroomMutation(c.config, OpCreate)
+	return &WpChatroomCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of WpChatroom entities.
+func (c *WpChatroomClient) CreateBulk(builders ...*WpChatroomCreate) *WpChatroomCreateBulk {
+	return &WpChatroomCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *WpChatroomClient) MapCreateBulk(slice any, setFunc func(*WpChatroomCreate, int)) *WpChatroomCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &WpChatroomCreateBulk{err: fmt.Errorf("calling to WpChatroomClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*WpChatroomCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &WpChatroomCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for WpChatroom.
+func (c *WpChatroomClient) Update() *WpChatroomUpdate {
+	mutation := newWpChatroomMutation(c.config, OpUpdate)
+	return &WpChatroomUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *WpChatroomClient) UpdateOne(wc *WpChatroom) *WpChatroomUpdateOne {
+	mutation := newWpChatroomMutation(c.config, OpUpdateOne, withWpChatroom(wc))
+	return &WpChatroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *WpChatroomClient) UpdateOneID(id uint64) *WpChatroomUpdateOne {
+	mutation := newWpChatroomMutation(c.config, OpUpdateOne, withWpChatroomID(id))
+	return &WpChatroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for WpChatroom.
+func (c *WpChatroomClient) Delete() *WpChatroomDelete {
+	mutation := newWpChatroomMutation(c.config, OpDelete)
+	return &WpChatroomDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *WpChatroomClient) DeleteOne(wc *WpChatroom) *WpChatroomDeleteOne {
+	return c.DeleteOneID(wc.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *WpChatroomClient) DeleteOneID(id uint64) *WpChatroomDeleteOne {
+	builder := c.Delete().Where(wpchatroom.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &WpChatroomDeleteOne{builder}
+}
+
+// Query returns a query builder for WpChatroom.
+func (c *WpChatroomClient) Query() *WpChatroomQuery {
+	return &WpChatroomQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeWpChatroom},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a WpChatroom entity by its id.
+func (c *WpChatroomClient) Get(ctx context.Context, id uint64) (*WpChatroom, error) {
+	return c.Query().Where(wpchatroom.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *WpChatroomClient) GetX(ctx context.Context, id uint64) *WpChatroom {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *WpChatroomClient) Hooks() []Hook {
+	return c.hooks.WpChatroom
+}
+
+// Interceptors returns the client interceptors.
+func (c *WpChatroomClient) Interceptors() []Interceptor {
+	return c.inters.WpChatroom
+}
+
+func (c *WpChatroomClient) mutate(ctx context.Context, m *WpChatroomMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&WpChatroomCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&WpChatroomUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&WpChatroomUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&WpChatroomDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown WpChatroom mutation op: %q", m.Op())
+	}
+}
+
+// WpChatroomMemberClient is a client for the WpChatroomMember schema.
+type WpChatroomMemberClient struct {
+	config
+}
+
+// NewWpChatroomMemberClient returns a client for the WpChatroomMember from the given config.
+func NewWpChatroomMemberClient(c config) *WpChatroomMemberClient {
+	return &WpChatroomMemberClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `wpchatroommember.Hooks(f(g(h())))`.
+func (c *WpChatroomMemberClient) Use(hooks ...Hook) {
+	c.hooks.WpChatroomMember = append(c.hooks.WpChatroomMember, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `wpchatroommember.Intercept(f(g(h())))`.
+func (c *WpChatroomMemberClient) Intercept(interceptors ...Interceptor) {
+	c.inters.WpChatroomMember = append(c.inters.WpChatroomMember, interceptors...)
+}
+
+// Create returns a builder for creating a WpChatroomMember entity.
+func (c *WpChatroomMemberClient) Create() *WpChatroomMemberCreate {
+	mutation := newWpChatroomMemberMutation(c.config, OpCreate)
+	return &WpChatroomMemberCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of WpChatroomMember entities.
+func (c *WpChatroomMemberClient) CreateBulk(builders ...*WpChatroomMemberCreate) *WpChatroomMemberCreateBulk {
+	return &WpChatroomMemberCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *WpChatroomMemberClient) MapCreateBulk(slice any, setFunc func(*WpChatroomMemberCreate, int)) *WpChatroomMemberCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &WpChatroomMemberCreateBulk{err: fmt.Errorf("calling to WpChatroomMemberClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*WpChatroomMemberCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &WpChatroomMemberCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for WpChatroomMember.
+func (c *WpChatroomMemberClient) Update() *WpChatroomMemberUpdate {
+	mutation := newWpChatroomMemberMutation(c.config, OpUpdate)
+	return &WpChatroomMemberUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *WpChatroomMemberClient) UpdateOne(wcm *WpChatroomMember) *WpChatroomMemberUpdateOne {
+	mutation := newWpChatroomMemberMutation(c.config, OpUpdateOne, withWpChatroomMember(wcm))
+	return &WpChatroomMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *WpChatroomMemberClient) UpdateOneID(id uint64) *WpChatroomMemberUpdateOne {
+	mutation := newWpChatroomMemberMutation(c.config, OpUpdateOne, withWpChatroomMemberID(id))
+	return &WpChatroomMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for WpChatroomMember.
+func (c *WpChatroomMemberClient) Delete() *WpChatroomMemberDelete {
+	mutation := newWpChatroomMemberMutation(c.config, OpDelete)
+	return &WpChatroomMemberDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *WpChatroomMemberClient) DeleteOne(wcm *WpChatroomMember) *WpChatroomMemberDeleteOne {
+	return c.DeleteOneID(wcm.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *WpChatroomMemberClient) DeleteOneID(id uint64) *WpChatroomMemberDeleteOne {
+	builder := c.Delete().Where(wpchatroommember.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &WpChatroomMemberDeleteOne{builder}
+}
+
+// Query returns a query builder for WpChatroomMember.
+func (c *WpChatroomMemberClient) Query() *WpChatroomMemberQuery {
+	return &WpChatroomMemberQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeWpChatroomMember},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a WpChatroomMember entity by its id.
+func (c *WpChatroomMemberClient) Get(ctx context.Context, id uint64) (*WpChatroomMember, error) {
+	return c.Query().Where(wpchatroommember.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *WpChatroomMemberClient) GetX(ctx context.Context, id uint64) *WpChatroomMember {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *WpChatroomMemberClient) Hooks() []Hook {
+	return c.hooks.WpChatroomMember
+}
+
+// Interceptors returns the client interceptors.
+func (c *WpChatroomMemberClient) Interceptors() []Interceptor {
+	return c.inters.WpChatroomMember
+}
+
+func (c *WpChatroomMemberClient) mutate(ctx context.Context, m *WpChatroomMemberMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&WpChatroomMemberCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&WpChatroomMemberUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&WpChatroomMemberUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&WpChatroomMemberDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown WpChatroomMember mutation op: %q", m.Op())
+	}
+}
+
 // WxClient is a client for the Wx schema.
 type WxClient struct {
 	config
@@ -4606,15 +4890,15 @@ type (
 		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
 		Contact, Employee, EmployeeConfig, Label, LabelRelationship, Message,
 		MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial,
-		UsageDetail, UsageTotal, WorkExperience, Wx, WxCard, WxCardUser,
-		WxCardVisit []ent.Hook
+		UsageDetail, UsageTotal, WorkExperience, WpChatroom, WpChatroomMember, Wx,
+		WxCard, WxCardUser, WxCardVisit []ent.Hook
 	}
 	inters struct {
 		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
 		Contact, Employee, EmployeeConfig, Label, LabelRelationship, Message,
 		MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial,
-		UsageDetail, UsageTotal, WorkExperience, Wx, WxCard, WxCardUser,
-		WxCardVisit []ent.Interceptor
+		UsageDetail, UsageTotal, WorkExperience, WpChatroom, WpChatroomMember, Wx,
+		WxCard, WxCardUser, WxCardVisit []ent.Interceptor
 	}
 )
 

+ 4 - 0
ent/ent.go

@@ -32,6 +32,8 @@ import (
 	"wechat-api/ent/usagedetail"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
 	"wechat-api/ent/wx"
 	"wechat-api/ent/wxcard"
 	"wechat-api/ent/wxcarduser"
@@ -124,6 +126,8 @@ func checkColumn(table, column string) error {
 			usagedetail.Table:       usagedetail.ValidColumn,
 			usagetotal.Table:        usagetotal.ValidColumn,
 			workexperience.Table:    workexperience.ValidColumn,
+			wpchatroom.Table:        wpchatroom.ValidColumn,
+			wpchatroommember.Table:  wpchatroommember.ValidColumn,
 			wx.Table:                wx.ValidColumn,
 			wxcard.Table:            wxcard.ValidColumn,
 			wxcarduser.Table:        wxcarduser.ValidColumn,

+ 24 - 0
ent/hook/hook.go

@@ -296,6 +296,30 @@ func (f WorkExperienceFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Val
 	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.WorkExperienceMutation", m)
 }
 
+// The WpChatroomFunc type is an adapter to allow the use of ordinary
+// function as WpChatroom mutator.
+type WpChatroomFunc func(context.Context, *ent.WpChatroomMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f WpChatroomFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.WpChatroomMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.WpChatroomMutation", m)
+}
+
+// The WpChatroomMemberFunc type is an adapter to allow the use of ordinary
+// function as WpChatroomMember mutator.
+type WpChatroomMemberFunc func(context.Context, *ent.WpChatroomMemberMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f WpChatroomMemberFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.WpChatroomMemberMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.WpChatroomMemberMutation", m)
+}
+
 // The WxFunc type is an adapter to allow the use of ordinary
 // function as Wx mutator.
 type WxFunc func(context.Context, *ent.WxMutation) (ent.Value, error)

+ 60 - 0
ent/intercept/intercept.go

@@ -31,6 +31,8 @@ import (
 	"wechat-api/ent/usagedetail"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
 	"wechat-api/ent/wx"
 	"wechat-api/ent/wxcard"
 	"wechat-api/ent/wxcarduser"
@@ -743,6 +745,60 @@ func (f TraverseWorkExperience) Traverse(ctx context.Context, q ent.Query) error
 	return fmt.Errorf("unexpected query type %T. expect *ent.WorkExperienceQuery", q)
 }
 
+// The WpChatroomFunc type is an adapter to allow the use of ordinary function as a Querier.
+type WpChatroomFunc func(context.Context, *ent.WpChatroomQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f WpChatroomFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.WpChatroomQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomQuery", q)
+}
+
+// The TraverseWpChatroom type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseWpChatroom func(context.Context, *ent.WpChatroomQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseWpChatroom) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseWpChatroom) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.WpChatroomQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomQuery", q)
+}
+
+// The WpChatroomMemberFunc type is an adapter to allow the use of ordinary function as a Querier.
+type WpChatroomMemberFunc func(context.Context, *ent.WpChatroomMemberQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f WpChatroomMemberFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.WpChatroomMemberQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomMemberQuery", q)
+}
+
+// The TraverseWpChatroomMember type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseWpChatroomMember func(context.Context, *ent.WpChatroomMemberQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseWpChatroomMember) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseWpChatroomMember) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.WpChatroomMemberQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.WpChatroomMemberQuery", q)
+}
+
 // The WxFunc type is an adapter to allow the use of ordinary function as a Querier.
 type WxFunc func(context.Context, *ent.WxQuery) (ent.Value, error)
 
@@ -902,6 +958,10 @@ func NewQuery(q ent.Query) (Query, error) {
 		return &query[*ent.UsageTotalQuery, predicate.UsageTotal, usagetotal.OrderOption]{typ: ent.TypeUsageTotal, tq: q}, nil
 	case *ent.WorkExperienceQuery:
 		return &query[*ent.WorkExperienceQuery, predicate.WorkExperience, workexperience.OrderOption]{typ: ent.TypeWorkExperience, tq: q}, nil
+	case *ent.WpChatroomQuery:
+		return &query[*ent.WpChatroomQuery, predicate.WpChatroom, wpchatroom.OrderOption]{typ: ent.TypeWpChatroom, tq: q}, nil
+	case *ent.WpChatroomMemberQuery:
+		return &query[*ent.WpChatroomMemberQuery, predicate.WpChatroomMember, wpchatroommember.OrderOption]{typ: ent.TypeWpChatroomMember, tq: q}, nil
 	case *ent.WxQuery:
 		return &query[*ent.WxQuery, predicate.Wx, wx.OrderOption]{typ: ent.TypeWx, tq: q}, nil
 	case *ent.WxCardQuery:

+ 58 - 0
ent/migrate/schema.go

@@ -808,6 +808,56 @@ var (
 			},
 		},
 	}
+	// WpChatroomColumns holds the columns for the "wp_chatroom" table.
+	WpChatroomColumns = []*schema.Column{
+		{Name: "id", Type: field.TypeUint64, Increment: true},
+		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
+		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
+		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
+		{Name: "wx_wxid", Type: field.TypeString, Comment: "所属微信id", Default: ""},
+		{Name: "chatroom_id", Type: field.TypeString, Comment: "群id", Default: ""},
+		{Name: "nickname", Type: field.TypeString, Comment: "群昵称", Default: ""},
+		{Name: "owner", Type: field.TypeString, Comment: "群主", Default: ""},
+		{Name: "avatar", Type: field.TypeString, Comment: "群头像", Default: ""},
+		{Name: "member_list", Type: field.TypeJSON, Comment: "群成员"},
+	}
+	// WpChatroomTable holds the schema information for the "wp_chatroom" table.
+	WpChatroomTable = &schema.Table{
+		Name:       "wp_chatroom",
+		Columns:    WpChatroomColumns,
+		PrimaryKey: []*schema.Column{WpChatroomColumns[0]},
+		Indexes: []*schema.Index{
+			{
+				Name:    "wpchatroom_wx_wxid_chatroom_id",
+				Unique:  false,
+				Columns: []*schema.Column{WpChatroomColumns[4], WpChatroomColumns[5]},
+			},
+		},
+	}
+	// WpChatroomMemberColumns holds the columns for the "wp_chatroom_member" table.
+	WpChatroomMemberColumns = []*schema.Column{
+		{Name: "id", Type: field.TypeUint64, Increment: true},
+		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
+		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
+		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
+		{Name: "wx_wxid", Type: field.TypeString, Comment: "所属微信id", Default: ""},
+		{Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
+		{Name: "nickname", Type: field.TypeString, Comment: "群昵称", Default: ""},
+		{Name: "avatar", Type: field.TypeString, Comment: "群头像", Default: ""},
+	}
+	// WpChatroomMemberTable holds the schema information for the "wp_chatroom_member" table.
+	WpChatroomMemberTable = &schema.Table{
+		Name:       "wp_chatroom_member",
+		Columns:    WpChatroomMemberColumns,
+		PrimaryKey: []*schema.Column{WpChatroomMemberColumns[0]},
+		Indexes: []*schema.Index{
+			{
+				Name:    "wpchatroommember_wx_wxid_wxid",
+				Unique:  false,
+				Columns: []*schema.Column{WpChatroomMemberColumns[4], WpChatroomMemberColumns[5]},
+			},
+		},
+	}
 	// WxColumns holds the columns for the "wx" table.
 	WxColumns = []*schema.Column{
 		{Name: "id", Type: field.TypeUint64, Increment: true},
@@ -1011,6 +1061,8 @@ var (
 		UsageDetailTable,
 		UsageTotalTable,
 		WorkExperienceTable,
+		WpChatroomTable,
+		WpChatroomMemberTable,
 		WxTable,
 		WxCardTable,
 		WxCardUserTable,
@@ -1101,6 +1153,12 @@ func init() {
 	WorkExperienceTable.Annotation = &entsql.Annotation{
 		Table: "work_experience",
 	}
+	WpChatroomTable.Annotation = &entsql.Annotation{
+		Table: "wp_chatroom",
+	}
+	WpChatroomMemberTable.Annotation = &entsql.Annotation{
+		Table: "wp_chatroom_member",
+	}
 	WxTable.ForeignKeys[0].RefTable = AgentTable
 	WxTable.ForeignKeys[1].RefTable = AgentBaseTable
 	WxTable.ForeignKeys[2].RefTable = ServerTable

+ 1558 - 0
ent/mutation.go

@@ -34,6 +34,8 @@ import (
 	"wechat-api/ent/usagedetail"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
 	"wechat-api/ent/wx"
 	"wechat-api/ent/wxcard"
 	"wechat-api/ent/wxcarduser"
@@ -76,6 +78,8 @@ const (
 	TypeUsageDetail       = "UsageDetail"
 	TypeUsageTotal        = "UsageTotal"
 	TypeWorkExperience    = "WorkExperience"
+	TypeWpChatroom        = "WpChatroom"
+	TypeWpChatroomMember  = "WpChatroomMember"
 	TypeWx                = "Wx"
 	TypeWxCard            = "WxCard"
 	TypeWxCardUser        = "WxCardUser"
@@ -27883,6 +27887,1560 @@ func (m *WorkExperienceMutation) ResetEdge(name string) error {
 	return fmt.Errorf("unknown WorkExperience edge %s", name)
 }
 
+// WpChatroomMutation represents an operation that mutates the WpChatroom nodes in the graph.
+type WpChatroomMutation struct {
+	config
+	op                Op
+	typ               string
+	id                *uint64
+	created_at        *time.Time
+	updated_at        *time.Time
+	status            *uint8
+	addstatus         *int8
+	wx_wxid           *string
+	chatroom_id       *string
+	nickname          *string
+	owner             *string
+	avatar            *string
+	member_list       *[]string
+	appendmember_list []string
+	clearedFields     map[string]struct{}
+	done              bool
+	oldValue          func(context.Context) (*WpChatroom, error)
+	predicates        []predicate.WpChatroom
+}
+
+var _ ent.Mutation = (*WpChatroomMutation)(nil)
+
+// wpchatroomOption allows management of the mutation configuration using functional options.
+type wpchatroomOption func(*WpChatroomMutation)
+
+// newWpChatroomMutation creates new mutation for the WpChatroom entity.
+func newWpChatroomMutation(c config, op Op, opts ...wpchatroomOption) *WpChatroomMutation {
+	m := &WpChatroomMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeWpChatroom,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withWpChatroomID sets the ID field of the mutation.
+func withWpChatroomID(id uint64) wpchatroomOption {
+	return func(m *WpChatroomMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *WpChatroom
+		)
+		m.oldValue = func(ctx context.Context) (*WpChatroom, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().WpChatroom.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withWpChatroom sets the old WpChatroom of the mutation.
+func withWpChatroom(node *WpChatroom) wpchatroomOption {
+	return func(m *WpChatroomMutation) {
+		m.oldValue = func(context.Context) (*WpChatroom, error) {
+			return node, nil
+		}
+		m.id = &node.ID
+	}
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m WpChatroomMutation) Client() *Client {
+	client := &Client{config: m.config}
+	client.init()
+	return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m WpChatroomMutation) Tx() (*Tx, error) {
+	if _, ok := m.driver.(*txDriver); !ok {
+		return nil, errors.New("ent: mutation is not running in a transaction")
+	}
+	tx := &Tx{config: m.config}
+	tx.init()
+	return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of WpChatroom entities.
+func (m *WpChatroomMutation) SetID(id uint64) {
+	m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *WpChatroomMutation) ID() (id uint64, exists bool) {
+	if m.id == nil {
+		return
+	}
+	return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *WpChatroomMutation) IDs(ctx context.Context) ([]uint64, error) {
+	switch {
+	case m.op.Is(OpUpdateOne | OpDeleteOne):
+		id, exists := m.ID()
+		if exists {
+			return []uint64{id}, nil
+		}
+		fallthrough
+	case m.op.Is(OpUpdate | OpDelete):
+		return m.Client().WpChatroom.Query().Where(m.predicates...).IDs(ctx)
+	default:
+		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+	}
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *WpChatroomMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *WpChatroomMutation) CreatedAt() (r time.Time, exists bool) {
+	v := m.created_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+	}
+	return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *WpChatroomMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *WpChatroomMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *WpChatroomMutation) UpdatedAt() (r time.Time, exists bool) {
+	v := m.updated_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+	}
+	return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *WpChatroomMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *WpChatroomMutation) SetStatus(u uint8) {
+	m.status = &u
+	m.addstatus = nil
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *WpChatroomMutation) Status() (r uint8, exists bool) {
+	v := m.status
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldStatus(ctx context.Context) (v uint8, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldStatus requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+	}
+	return oldValue.Status, nil
+}
+
+// AddStatus adds u to the "status" field.
+func (m *WpChatroomMutation) AddStatus(u int8) {
+	if m.addstatus != nil {
+		*m.addstatus += u
+	} else {
+		m.addstatus = &u
+	}
+}
+
+// AddedStatus returns the value that was added to the "status" field in this mutation.
+func (m *WpChatroomMutation) AddedStatus() (r int8, exists bool) {
+	v := m.addstatus
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearStatus clears the value of the "status" field.
+func (m *WpChatroomMutation) ClearStatus() {
+	m.status = nil
+	m.addstatus = nil
+	m.clearedFields[wpchatroom.FieldStatus] = struct{}{}
+}
+
+// StatusCleared returns if the "status" field was cleared in this mutation.
+func (m *WpChatroomMutation) StatusCleared() bool {
+	_, ok := m.clearedFields[wpchatroom.FieldStatus]
+	return ok
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *WpChatroomMutation) ResetStatus() {
+	m.status = nil
+	m.addstatus = nil
+	delete(m.clearedFields, wpchatroom.FieldStatus)
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (m *WpChatroomMutation) SetWxWxid(s string) {
+	m.wx_wxid = &s
+}
+
+// WxWxid returns the value of the "wx_wxid" field in the mutation.
+func (m *WpChatroomMutation) WxWxid() (r string, exists bool) {
+	v := m.wx_wxid
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldWxWxid returns the old "wx_wxid" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldWxWxid(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldWxWxid is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldWxWxid requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldWxWxid: %w", err)
+	}
+	return oldValue.WxWxid, nil
+}
+
+// ResetWxWxid resets all changes to the "wx_wxid" field.
+func (m *WpChatroomMutation) ResetWxWxid() {
+	m.wx_wxid = nil
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (m *WpChatroomMutation) SetChatroomID(s string) {
+	m.chatroom_id = &s
+}
+
+// ChatroomID returns the value of the "chatroom_id" field in the mutation.
+func (m *WpChatroomMutation) ChatroomID() (r string, exists bool) {
+	v := m.chatroom_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldChatroomID returns the old "chatroom_id" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldChatroomID(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldChatroomID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldChatroomID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldChatroomID: %w", err)
+	}
+	return oldValue.ChatroomID, nil
+}
+
+// ResetChatroomID resets all changes to the "chatroom_id" field.
+func (m *WpChatroomMutation) ResetChatroomID() {
+	m.chatroom_id = nil
+}
+
+// SetNickname sets the "nickname" field.
+func (m *WpChatroomMutation) SetNickname(s string) {
+	m.nickname = &s
+}
+
+// Nickname returns the value of the "nickname" field in the mutation.
+func (m *WpChatroomMutation) Nickname() (r string, exists bool) {
+	v := m.nickname
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldNickname returns the old "nickname" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldNickname(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldNickname is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldNickname requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldNickname: %w", err)
+	}
+	return oldValue.Nickname, nil
+}
+
+// ResetNickname resets all changes to the "nickname" field.
+func (m *WpChatroomMutation) ResetNickname() {
+	m.nickname = nil
+}
+
+// SetOwner sets the "owner" field.
+func (m *WpChatroomMutation) SetOwner(s string) {
+	m.owner = &s
+}
+
+// Owner returns the value of the "owner" field in the mutation.
+func (m *WpChatroomMutation) Owner() (r string, exists bool) {
+	v := m.owner
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldOwner returns the old "owner" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldOwner(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldOwner is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldOwner requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldOwner: %w", err)
+	}
+	return oldValue.Owner, nil
+}
+
+// ResetOwner resets all changes to the "owner" field.
+func (m *WpChatroomMutation) ResetOwner() {
+	m.owner = nil
+}
+
+// SetAvatar sets the "avatar" field.
+func (m *WpChatroomMutation) SetAvatar(s string) {
+	m.avatar = &s
+}
+
+// Avatar returns the value of the "avatar" field in the mutation.
+func (m *WpChatroomMutation) Avatar() (r string, exists bool) {
+	v := m.avatar
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAvatar returns the old "avatar" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldAvatar(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAvatar is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAvatar requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAvatar: %w", err)
+	}
+	return oldValue.Avatar, nil
+}
+
+// ResetAvatar resets all changes to the "avatar" field.
+func (m *WpChatroomMutation) ResetAvatar() {
+	m.avatar = nil
+}
+
+// SetMemberList sets the "member_list" field.
+func (m *WpChatroomMutation) SetMemberList(s []string) {
+	m.member_list = &s
+	m.appendmember_list = nil
+}
+
+// MemberList returns the value of the "member_list" field in the mutation.
+func (m *WpChatroomMutation) MemberList() (r []string, exists bool) {
+	v := m.member_list
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldMemberList returns the old "member_list" field's value of the WpChatroom entity.
+// If the WpChatroom object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMutation) OldMemberList(ctx context.Context) (v []string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldMemberList is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldMemberList requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldMemberList: %w", err)
+	}
+	return oldValue.MemberList, nil
+}
+
+// AppendMemberList adds s to the "member_list" field.
+func (m *WpChatroomMutation) AppendMemberList(s []string) {
+	m.appendmember_list = append(m.appendmember_list, s...)
+}
+
+// AppendedMemberList returns the list of values that were appended to the "member_list" field in this mutation.
+func (m *WpChatroomMutation) AppendedMemberList() ([]string, bool) {
+	if len(m.appendmember_list) == 0 {
+		return nil, false
+	}
+	return m.appendmember_list, true
+}
+
+// ResetMemberList resets all changes to the "member_list" field.
+func (m *WpChatroomMutation) ResetMemberList() {
+	m.member_list = nil
+	m.appendmember_list = nil
+}
+
+// Where appends a list predicates to the WpChatroomMutation builder.
+func (m *WpChatroomMutation) Where(ps ...predicate.WpChatroom) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the WpChatroomMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *WpChatroomMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.WpChatroom, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *WpChatroomMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *WpChatroomMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (WpChatroom).
+func (m *WpChatroomMutation) Type() string {
+	return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *WpChatroomMutation) Fields() []string {
+	fields := make([]string, 0, 9)
+	if m.created_at != nil {
+		fields = append(fields, wpchatroom.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, wpchatroom.FieldUpdatedAt)
+	}
+	if m.status != nil {
+		fields = append(fields, wpchatroom.FieldStatus)
+	}
+	if m.wx_wxid != nil {
+		fields = append(fields, wpchatroom.FieldWxWxid)
+	}
+	if m.chatroom_id != nil {
+		fields = append(fields, wpchatroom.FieldChatroomID)
+	}
+	if m.nickname != nil {
+		fields = append(fields, wpchatroom.FieldNickname)
+	}
+	if m.owner != nil {
+		fields = append(fields, wpchatroom.FieldOwner)
+	}
+	if m.avatar != nil {
+		fields = append(fields, wpchatroom.FieldAvatar)
+	}
+	if m.member_list != nil {
+		fields = append(fields, wpchatroom.FieldMemberList)
+	}
+	return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *WpChatroomMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case wpchatroom.FieldCreatedAt:
+		return m.CreatedAt()
+	case wpchatroom.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case wpchatroom.FieldStatus:
+		return m.Status()
+	case wpchatroom.FieldWxWxid:
+		return m.WxWxid()
+	case wpchatroom.FieldChatroomID:
+		return m.ChatroomID()
+	case wpchatroom.FieldNickname:
+		return m.Nickname()
+	case wpchatroom.FieldOwner:
+		return m.Owner()
+	case wpchatroom.FieldAvatar:
+		return m.Avatar()
+	case wpchatroom.FieldMemberList:
+		return m.MemberList()
+	}
+	return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *WpChatroomMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case wpchatroom.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case wpchatroom.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case wpchatroom.FieldStatus:
+		return m.OldStatus(ctx)
+	case wpchatroom.FieldWxWxid:
+		return m.OldWxWxid(ctx)
+	case wpchatroom.FieldChatroomID:
+		return m.OldChatroomID(ctx)
+	case wpchatroom.FieldNickname:
+		return m.OldNickname(ctx)
+	case wpchatroom.FieldOwner:
+		return m.OldOwner(ctx)
+	case wpchatroom.FieldAvatar:
+		return m.OldAvatar(ctx)
+	case wpchatroom.FieldMemberList:
+		return m.OldMemberList(ctx)
+	}
+	return nil, fmt.Errorf("unknown WpChatroom field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *WpChatroomMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case wpchatroom.FieldCreatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCreatedAt(v)
+		return nil
+	case wpchatroom.FieldUpdatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUpdatedAt(v)
+		return nil
+	case wpchatroom.FieldStatus:
+		v, ok := value.(uint8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetStatus(v)
+		return nil
+	case wpchatroom.FieldWxWxid:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetWxWxid(v)
+		return nil
+	case wpchatroom.FieldChatroomID:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetChatroomID(v)
+		return nil
+	case wpchatroom.FieldNickname:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetNickname(v)
+		return nil
+	case wpchatroom.FieldOwner:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetOwner(v)
+		return nil
+	case wpchatroom.FieldAvatar:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAvatar(v)
+		return nil
+	case wpchatroom.FieldMemberList:
+		v, ok := value.([]string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetMemberList(v)
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroom field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *WpChatroomMutation) AddedFields() []string {
+	var fields []string
+	if m.addstatus != nil {
+		fields = append(fields, wpchatroom.FieldStatus)
+	}
+	return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *WpChatroomMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case wpchatroom.FieldStatus:
+		return m.AddedStatus()
+	}
+	return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *WpChatroomMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case wpchatroom.FieldStatus:
+		v, ok := value.(int8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddStatus(v)
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroom numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *WpChatroomMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(wpchatroom.FieldStatus) {
+		fields = append(fields, wpchatroom.FieldStatus)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *WpChatroomMutation) FieldCleared(name string) bool {
+	_, ok := m.clearedFields[name]
+	return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *WpChatroomMutation) ClearField(name string) error {
+	switch name {
+	case wpchatroom.FieldStatus:
+		m.ClearStatus()
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroom nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *WpChatroomMutation) ResetField(name string) error {
+	switch name {
+	case wpchatroom.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case wpchatroom.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case wpchatroom.FieldStatus:
+		m.ResetStatus()
+		return nil
+	case wpchatroom.FieldWxWxid:
+		m.ResetWxWxid()
+		return nil
+	case wpchatroom.FieldChatroomID:
+		m.ResetChatroomID()
+		return nil
+	case wpchatroom.FieldNickname:
+		m.ResetNickname()
+		return nil
+	case wpchatroom.FieldOwner:
+		m.ResetOwner()
+		return nil
+	case wpchatroom.FieldAvatar:
+		m.ResetAvatar()
+		return nil
+	case wpchatroom.FieldMemberList:
+		m.ResetMemberList()
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroom field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *WpChatroomMutation) AddedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *WpChatroomMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *WpChatroomMutation) RemovedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *WpChatroomMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *WpChatroomMutation) ClearedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *WpChatroomMutation) EdgeCleared(name string) bool {
+	return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *WpChatroomMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown WpChatroom unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *WpChatroomMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown WpChatroom edge %s", name)
+}
+
+// WpChatroomMemberMutation represents an operation that mutates the WpChatroomMember nodes in the graph.
+type WpChatroomMemberMutation struct {
+	config
+	op            Op
+	typ           string
+	id            *uint64
+	created_at    *time.Time
+	updated_at    *time.Time
+	status        *uint8
+	addstatus     *int8
+	wx_wxid       *string
+	wxid          *string
+	nickname      *string
+	avatar        *string
+	clearedFields map[string]struct{}
+	done          bool
+	oldValue      func(context.Context) (*WpChatroomMember, error)
+	predicates    []predicate.WpChatroomMember
+}
+
+var _ ent.Mutation = (*WpChatroomMemberMutation)(nil)
+
+// wpchatroommemberOption allows management of the mutation configuration using functional options.
+type wpchatroommemberOption func(*WpChatroomMemberMutation)
+
+// newWpChatroomMemberMutation creates new mutation for the WpChatroomMember entity.
+func newWpChatroomMemberMutation(c config, op Op, opts ...wpchatroommemberOption) *WpChatroomMemberMutation {
+	m := &WpChatroomMemberMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeWpChatroomMember,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withWpChatroomMemberID sets the ID field of the mutation.
+func withWpChatroomMemberID(id uint64) wpchatroommemberOption {
+	return func(m *WpChatroomMemberMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *WpChatroomMember
+		)
+		m.oldValue = func(ctx context.Context) (*WpChatroomMember, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().WpChatroomMember.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withWpChatroomMember sets the old WpChatroomMember of the mutation.
+func withWpChatroomMember(node *WpChatroomMember) wpchatroommemberOption {
+	return func(m *WpChatroomMemberMutation) {
+		m.oldValue = func(context.Context) (*WpChatroomMember, error) {
+			return node, nil
+		}
+		m.id = &node.ID
+	}
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m WpChatroomMemberMutation) Client() *Client {
+	client := &Client{config: m.config}
+	client.init()
+	return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m WpChatroomMemberMutation) Tx() (*Tx, error) {
+	if _, ok := m.driver.(*txDriver); !ok {
+		return nil, errors.New("ent: mutation is not running in a transaction")
+	}
+	tx := &Tx{config: m.config}
+	tx.init()
+	return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of WpChatroomMember entities.
+func (m *WpChatroomMemberMutation) SetID(id uint64) {
+	m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *WpChatroomMemberMutation) ID() (id uint64, exists bool) {
+	if m.id == nil {
+		return
+	}
+	return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *WpChatroomMemberMutation) IDs(ctx context.Context) ([]uint64, error) {
+	switch {
+	case m.op.Is(OpUpdateOne | OpDeleteOne):
+		id, exists := m.ID()
+		if exists {
+			return []uint64{id}, nil
+		}
+		fallthrough
+	case m.op.Is(OpUpdate | OpDelete):
+		return m.Client().WpChatroomMember.Query().Where(m.predicates...).IDs(ctx)
+	default:
+		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+	}
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *WpChatroomMemberMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *WpChatroomMemberMutation) CreatedAt() (r time.Time, exists bool) {
+	v := m.created_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+	}
+	return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *WpChatroomMemberMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *WpChatroomMemberMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *WpChatroomMemberMutation) UpdatedAt() (r time.Time, exists bool) {
+	v := m.updated_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+	}
+	return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *WpChatroomMemberMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *WpChatroomMemberMutation) SetStatus(u uint8) {
+	m.status = &u
+	m.addstatus = nil
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *WpChatroomMemberMutation) Status() (r uint8, exists bool) {
+	v := m.status
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldStatus(ctx context.Context) (v uint8, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldStatus requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+	}
+	return oldValue.Status, nil
+}
+
+// AddStatus adds u to the "status" field.
+func (m *WpChatroomMemberMutation) AddStatus(u int8) {
+	if m.addstatus != nil {
+		*m.addstatus += u
+	} else {
+		m.addstatus = &u
+	}
+}
+
+// AddedStatus returns the value that was added to the "status" field in this mutation.
+func (m *WpChatroomMemberMutation) AddedStatus() (r int8, exists bool) {
+	v := m.addstatus
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearStatus clears the value of the "status" field.
+func (m *WpChatroomMemberMutation) ClearStatus() {
+	m.status = nil
+	m.addstatus = nil
+	m.clearedFields[wpchatroommember.FieldStatus] = struct{}{}
+}
+
+// StatusCleared returns if the "status" field was cleared in this mutation.
+func (m *WpChatroomMemberMutation) StatusCleared() bool {
+	_, ok := m.clearedFields[wpchatroommember.FieldStatus]
+	return ok
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *WpChatroomMemberMutation) ResetStatus() {
+	m.status = nil
+	m.addstatus = nil
+	delete(m.clearedFields, wpchatroommember.FieldStatus)
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (m *WpChatroomMemberMutation) SetWxWxid(s string) {
+	m.wx_wxid = &s
+}
+
+// WxWxid returns the value of the "wx_wxid" field in the mutation.
+func (m *WpChatroomMemberMutation) WxWxid() (r string, exists bool) {
+	v := m.wx_wxid
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldWxWxid returns the old "wx_wxid" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldWxWxid(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldWxWxid is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldWxWxid requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldWxWxid: %w", err)
+	}
+	return oldValue.WxWxid, nil
+}
+
+// ResetWxWxid resets all changes to the "wx_wxid" field.
+func (m *WpChatroomMemberMutation) ResetWxWxid() {
+	m.wx_wxid = nil
+}
+
+// SetWxid sets the "wxid" field.
+func (m *WpChatroomMemberMutation) SetWxid(s string) {
+	m.wxid = &s
+}
+
+// Wxid returns the value of the "wxid" field in the mutation.
+func (m *WpChatroomMemberMutation) Wxid() (r string, exists bool) {
+	v := m.wxid
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldWxid returns the old "wxid" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldWxid(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldWxid is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldWxid requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldWxid: %w", err)
+	}
+	return oldValue.Wxid, nil
+}
+
+// ResetWxid resets all changes to the "wxid" field.
+func (m *WpChatroomMemberMutation) ResetWxid() {
+	m.wxid = nil
+}
+
+// SetNickname sets the "nickname" field.
+func (m *WpChatroomMemberMutation) SetNickname(s string) {
+	m.nickname = &s
+}
+
+// Nickname returns the value of the "nickname" field in the mutation.
+func (m *WpChatroomMemberMutation) Nickname() (r string, exists bool) {
+	v := m.nickname
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldNickname returns the old "nickname" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldNickname(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldNickname is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldNickname requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldNickname: %w", err)
+	}
+	return oldValue.Nickname, nil
+}
+
+// ResetNickname resets all changes to the "nickname" field.
+func (m *WpChatroomMemberMutation) ResetNickname() {
+	m.nickname = nil
+}
+
+// SetAvatar sets the "avatar" field.
+func (m *WpChatroomMemberMutation) SetAvatar(s string) {
+	m.avatar = &s
+}
+
+// Avatar returns the value of the "avatar" field in the mutation.
+func (m *WpChatroomMemberMutation) Avatar() (r string, exists bool) {
+	v := m.avatar
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldAvatar returns the old "avatar" field's value of the WpChatroomMember entity.
+// If the WpChatroomMember object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *WpChatroomMemberMutation) OldAvatar(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldAvatar is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldAvatar requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldAvatar: %w", err)
+	}
+	return oldValue.Avatar, nil
+}
+
+// ResetAvatar resets all changes to the "avatar" field.
+func (m *WpChatroomMemberMutation) ResetAvatar() {
+	m.avatar = nil
+}
+
+// Where appends a list predicates to the WpChatroomMemberMutation builder.
+func (m *WpChatroomMemberMutation) Where(ps ...predicate.WpChatroomMember) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the WpChatroomMemberMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *WpChatroomMemberMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.WpChatroomMember, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *WpChatroomMemberMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *WpChatroomMemberMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (WpChatroomMember).
+func (m *WpChatroomMemberMutation) Type() string {
+	return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *WpChatroomMemberMutation) Fields() []string {
+	fields := make([]string, 0, 7)
+	if m.created_at != nil {
+		fields = append(fields, wpchatroommember.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, wpchatroommember.FieldUpdatedAt)
+	}
+	if m.status != nil {
+		fields = append(fields, wpchatroommember.FieldStatus)
+	}
+	if m.wx_wxid != nil {
+		fields = append(fields, wpchatroommember.FieldWxWxid)
+	}
+	if m.wxid != nil {
+		fields = append(fields, wpchatroommember.FieldWxid)
+	}
+	if m.nickname != nil {
+		fields = append(fields, wpchatroommember.FieldNickname)
+	}
+	if m.avatar != nil {
+		fields = append(fields, wpchatroommember.FieldAvatar)
+	}
+	return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *WpChatroomMemberMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case wpchatroommember.FieldCreatedAt:
+		return m.CreatedAt()
+	case wpchatroommember.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case wpchatroommember.FieldStatus:
+		return m.Status()
+	case wpchatroommember.FieldWxWxid:
+		return m.WxWxid()
+	case wpchatroommember.FieldWxid:
+		return m.Wxid()
+	case wpchatroommember.FieldNickname:
+		return m.Nickname()
+	case wpchatroommember.FieldAvatar:
+		return m.Avatar()
+	}
+	return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *WpChatroomMemberMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case wpchatroommember.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case wpchatroommember.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case wpchatroommember.FieldStatus:
+		return m.OldStatus(ctx)
+	case wpchatroommember.FieldWxWxid:
+		return m.OldWxWxid(ctx)
+	case wpchatroommember.FieldWxid:
+		return m.OldWxid(ctx)
+	case wpchatroommember.FieldNickname:
+		return m.OldNickname(ctx)
+	case wpchatroommember.FieldAvatar:
+		return m.OldAvatar(ctx)
+	}
+	return nil, fmt.Errorf("unknown WpChatroomMember field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *WpChatroomMemberMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case wpchatroommember.FieldCreatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCreatedAt(v)
+		return nil
+	case wpchatroommember.FieldUpdatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUpdatedAt(v)
+		return nil
+	case wpchatroommember.FieldStatus:
+		v, ok := value.(uint8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetStatus(v)
+		return nil
+	case wpchatroommember.FieldWxWxid:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetWxWxid(v)
+		return nil
+	case wpchatroommember.FieldWxid:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetWxid(v)
+		return nil
+	case wpchatroommember.FieldNickname:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetNickname(v)
+		return nil
+	case wpchatroommember.FieldAvatar:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetAvatar(v)
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroomMember field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *WpChatroomMemberMutation) AddedFields() []string {
+	var fields []string
+	if m.addstatus != nil {
+		fields = append(fields, wpchatroommember.FieldStatus)
+	}
+	return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *WpChatroomMemberMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case wpchatroommember.FieldStatus:
+		return m.AddedStatus()
+	}
+	return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *WpChatroomMemberMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case wpchatroommember.FieldStatus:
+		v, ok := value.(int8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddStatus(v)
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroomMember numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *WpChatroomMemberMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(wpchatroommember.FieldStatus) {
+		fields = append(fields, wpchatroommember.FieldStatus)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *WpChatroomMemberMutation) FieldCleared(name string) bool {
+	_, ok := m.clearedFields[name]
+	return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *WpChatroomMemberMutation) ClearField(name string) error {
+	switch name {
+	case wpchatroommember.FieldStatus:
+		m.ClearStatus()
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroomMember nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *WpChatroomMemberMutation) ResetField(name string) error {
+	switch name {
+	case wpchatroommember.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case wpchatroommember.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case wpchatroommember.FieldStatus:
+		m.ResetStatus()
+		return nil
+	case wpchatroommember.FieldWxWxid:
+		m.ResetWxWxid()
+		return nil
+	case wpchatroommember.FieldWxid:
+		m.ResetWxid()
+		return nil
+	case wpchatroommember.FieldNickname:
+		m.ResetNickname()
+		return nil
+	case wpchatroommember.FieldAvatar:
+		m.ResetAvatar()
+		return nil
+	}
+	return fmt.Errorf("unknown WpChatroomMember field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *WpChatroomMemberMutation) AddedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *WpChatroomMemberMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *WpChatroomMemberMutation) RemovedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *WpChatroomMemberMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *WpChatroomMemberMutation) ClearedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *WpChatroomMemberMutation) EdgeCleared(name string) bool {
+	return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *WpChatroomMemberMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown WpChatroomMember unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *WpChatroomMemberMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown WpChatroomMember edge %s", name)
+}
+
 // WxMutation represents an operation that mutates the Wx nodes in the graph.
 type WxMutation struct {
 	config

+ 164 - 0
ent/pagination.go

@@ -29,6 +29,8 @@ import (
 	"wechat-api/ent/usagedetail"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
 	"wechat-api/ent/wx"
 	"wechat-api/ent/wxcard"
 	"wechat-api/ent/wxcarduser"
@@ -2025,6 +2027,168 @@ func (we *WorkExperienceQuery) Page(
 	return ret, nil
 }
 
+type WpChatroomPager struct {
+	Order  wpchatroom.OrderOption
+	Filter func(*WpChatroomQuery) (*WpChatroomQuery, error)
+}
+
+// WpChatroomPaginateOption enables pagination customization.
+type WpChatroomPaginateOption func(*WpChatroomPager)
+
+// DefaultWpChatroomOrder is the default ordering of WpChatroom.
+var DefaultWpChatroomOrder = Desc(wpchatroom.FieldID)
+
+func newWpChatroomPager(opts []WpChatroomPaginateOption) (*WpChatroomPager, error) {
+	pager := &WpChatroomPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultWpChatroomOrder
+	}
+	return pager, nil
+}
+
+func (p *WpChatroomPager) ApplyFilter(query *WpChatroomQuery) (*WpChatroomQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// WpChatroomPageList is WpChatroom PageList result.
+type WpChatroomPageList struct {
+	List        []*WpChatroom `json:"list"`
+	PageDetails *PageDetails  `json:"pageDetails"`
+}
+
+func (wc *WpChatroomQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...WpChatroomPaginateOption,
+) (*WpChatroomPageList, error) {
+
+	pager, err := newWpChatroomPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if wc, err = pager.ApplyFilter(wc); err != nil {
+		return nil, err
+	}
+
+	ret := &WpChatroomPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := wc.Clone()
+	query.ctx.Fields = nil
+	count, err := query.Count(ctx)
+
+	if err != nil {
+		return nil, err
+	}
+
+	ret.PageDetails.Total = uint64(count)
+
+	if pager.Order != nil {
+		wc = wc.Order(pager.Order)
+	} else {
+		wc = wc.Order(DefaultWpChatroomOrder)
+	}
+
+	wc = wc.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := wc.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
+type WpChatroomMemberPager struct {
+	Order  wpchatroommember.OrderOption
+	Filter func(*WpChatroomMemberQuery) (*WpChatroomMemberQuery, error)
+}
+
+// WpChatroomMemberPaginateOption enables pagination customization.
+type WpChatroomMemberPaginateOption func(*WpChatroomMemberPager)
+
+// DefaultWpChatroomMemberOrder is the default ordering of WpChatroomMember.
+var DefaultWpChatroomMemberOrder = Desc(wpchatroommember.FieldID)
+
+func newWpChatroomMemberPager(opts []WpChatroomMemberPaginateOption) (*WpChatroomMemberPager, error) {
+	pager := &WpChatroomMemberPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultWpChatroomMemberOrder
+	}
+	return pager, nil
+}
+
+func (p *WpChatroomMemberPager) ApplyFilter(query *WpChatroomMemberQuery) (*WpChatroomMemberQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// WpChatroomMemberPageList is WpChatroomMember PageList result.
+type WpChatroomMemberPageList struct {
+	List        []*WpChatroomMember `json:"list"`
+	PageDetails *PageDetails        `json:"pageDetails"`
+}
+
+func (wcm *WpChatroomMemberQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...WpChatroomMemberPaginateOption,
+) (*WpChatroomMemberPageList, error) {
+
+	pager, err := newWpChatroomMemberPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if wcm, err = pager.ApplyFilter(wcm); err != nil {
+		return nil, err
+	}
+
+	ret := &WpChatroomMemberPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := wcm.Clone()
+	query.ctx.Fields = nil
+	count, err := query.Count(ctx)
+
+	if err != nil {
+		return nil, err
+	}
+
+	ret.PageDetails.Total = uint64(count)
+
+	if pager.Order != nil {
+		wcm = wcm.Order(pager.Order)
+	} else {
+		wcm = wcm.Order(DefaultWpChatroomMemberOrder)
+	}
+
+	wcm = wcm.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := wcm.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
 type WxPager struct {
 	Order  wx.OrderOption
 	Filter func(*WxQuery) (*WxQuery, error)

+ 6 - 0
ent/predicate/predicate.go

@@ -78,6 +78,12 @@ type UsageTotal func(*sql.Selector)
 // WorkExperience is the predicate function for workexperience builders.
 type WorkExperience func(*sql.Selector)
 
+// WpChatroom is the predicate function for wpchatroom builders.
+type WpChatroom func(*sql.Selector)
+
+// WpChatroomMember is the predicate function for wpchatroommember builders.
+type WpChatroomMember func(*sql.Selector)
+
 // Wx is the predicate function for wx builders.
 type Wx func(*sql.Selector)
 

+ 80 - 0
ent/runtime/runtime.go

@@ -29,6 +29,8 @@ import (
 	"wechat-api/ent/usagedetail"
 	"wechat-api/ent/usagetotal"
 	"wechat-api/ent/workexperience"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
 	"wechat-api/ent/wx"
 	"wechat-api/ent/wxcard"
 	"wechat-api/ent/wxcarduser"
@@ -1029,6 +1031,84 @@ func init() {
 	workexperience.DefaultUpdatedAt = workexperienceDescUpdatedAt.Default.(func() time.Time)
 	// workexperience.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
 	workexperience.UpdateDefaultUpdatedAt = workexperienceDescUpdatedAt.UpdateDefault.(func() time.Time)
+	wpchatroomMixin := schema.WpChatroom{}.Mixin()
+	wpchatroomMixinFields0 := wpchatroomMixin[0].Fields()
+	_ = wpchatroomMixinFields0
+	wpchatroomMixinFields1 := wpchatroomMixin[1].Fields()
+	_ = wpchatroomMixinFields1
+	wpchatroomFields := schema.WpChatroom{}.Fields()
+	_ = wpchatroomFields
+	// wpchatroomDescCreatedAt is the schema descriptor for created_at field.
+	wpchatroomDescCreatedAt := wpchatroomMixinFields0[1].Descriptor()
+	// wpchatroom.DefaultCreatedAt holds the default value on creation for the created_at field.
+	wpchatroom.DefaultCreatedAt = wpchatroomDescCreatedAt.Default.(func() time.Time)
+	// wpchatroomDescUpdatedAt is the schema descriptor for updated_at field.
+	wpchatroomDescUpdatedAt := wpchatroomMixinFields0[2].Descriptor()
+	// wpchatroom.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	wpchatroom.DefaultUpdatedAt = wpchatroomDescUpdatedAt.Default.(func() time.Time)
+	// wpchatroom.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	wpchatroom.UpdateDefaultUpdatedAt = wpchatroomDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// wpchatroomDescStatus is the schema descriptor for status field.
+	wpchatroomDescStatus := wpchatroomMixinFields1[0].Descriptor()
+	// wpchatroom.DefaultStatus holds the default value on creation for the status field.
+	wpchatroom.DefaultStatus = wpchatroomDescStatus.Default.(uint8)
+	// wpchatroomDescWxWxid is the schema descriptor for wx_wxid field.
+	wpchatroomDescWxWxid := wpchatroomFields[0].Descriptor()
+	// wpchatroom.DefaultWxWxid holds the default value on creation for the wx_wxid field.
+	wpchatroom.DefaultWxWxid = wpchatroomDescWxWxid.Default.(string)
+	// wpchatroomDescChatroomID is the schema descriptor for chatroom_id field.
+	wpchatroomDescChatroomID := wpchatroomFields[1].Descriptor()
+	// wpchatroom.DefaultChatroomID holds the default value on creation for the chatroom_id field.
+	wpchatroom.DefaultChatroomID = wpchatroomDescChatroomID.Default.(string)
+	// wpchatroomDescNickname is the schema descriptor for nickname field.
+	wpchatroomDescNickname := wpchatroomFields[2].Descriptor()
+	// wpchatroom.DefaultNickname holds the default value on creation for the nickname field.
+	wpchatroom.DefaultNickname = wpchatroomDescNickname.Default.(string)
+	// wpchatroomDescOwner is the schema descriptor for owner field.
+	wpchatroomDescOwner := wpchatroomFields[3].Descriptor()
+	// wpchatroom.DefaultOwner holds the default value on creation for the owner field.
+	wpchatroom.DefaultOwner = wpchatroomDescOwner.Default.(string)
+	// wpchatroomDescAvatar is the schema descriptor for avatar field.
+	wpchatroomDescAvatar := wpchatroomFields[4].Descriptor()
+	// wpchatroom.DefaultAvatar holds the default value on creation for the avatar field.
+	wpchatroom.DefaultAvatar = wpchatroomDescAvatar.Default.(string)
+	wpchatroommemberMixin := schema.WpChatroomMember{}.Mixin()
+	wpchatroommemberMixinFields0 := wpchatroommemberMixin[0].Fields()
+	_ = wpchatroommemberMixinFields0
+	wpchatroommemberMixinFields1 := wpchatroommemberMixin[1].Fields()
+	_ = wpchatroommemberMixinFields1
+	wpchatroommemberFields := schema.WpChatroomMember{}.Fields()
+	_ = wpchatroommemberFields
+	// wpchatroommemberDescCreatedAt is the schema descriptor for created_at field.
+	wpchatroommemberDescCreatedAt := wpchatroommemberMixinFields0[1].Descriptor()
+	// wpchatroommember.DefaultCreatedAt holds the default value on creation for the created_at field.
+	wpchatroommember.DefaultCreatedAt = wpchatroommemberDescCreatedAt.Default.(func() time.Time)
+	// wpchatroommemberDescUpdatedAt is the schema descriptor for updated_at field.
+	wpchatroommemberDescUpdatedAt := wpchatroommemberMixinFields0[2].Descriptor()
+	// wpchatroommember.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	wpchatroommember.DefaultUpdatedAt = wpchatroommemberDescUpdatedAt.Default.(func() time.Time)
+	// wpchatroommember.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	wpchatroommember.UpdateDefaultUpdatedAt = wpchatroommemberDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// wpchatroommemberDescStatus is the schema descriptor for status field.
+	wpchatroommemberDescStatus := wpchatroommemberMixinFields1[0].Descriptor()
+	// wpchatroommember.DefaultStatus holds the default value on creation for the status field.
+	wpchatroommember.DefaultStatus = wpchatroommemberDescStatus.Default.(uint8)
+	// wpchatroommemberDescWxWxid is the schema descriptor for wx_wxid field.
+	wpchatroommemberDescWxWxid := wpchatroommemberFields[0].Descriptor()
+	// wpchatroommember.DefaultWxWxid holds the default value on creation for the wx_wxid field.
+	wpchatroommember.DefaultWxWxid = wpchatroommemberDescWxWxid.Default.(string)
+	// wpchatroommemberDescWxid is the schema descriptor for wxid field.
+	wpchatroommemberDescWxid := wpchatroommemberFields[1].Descriptor()
+	// wpchatroommember.DefaultWxid holds the default value on creation for the wxid field.
+	wpchatroommember.DefaultWxid = wpchatroommemberDescWxid.Default.(string)
+	// wpchatroommemberDescNickname is the schema descriptor for nickname field.
+	wpchatroommemberDescNickname := wpchatroommemberFields[2].Descriptor()
+	// wpchatroommember.DefaultNickname holds the default value on creation for the nickname field.
+	wpchatroommember.DefaultNickname = wpchatroommemberDescNickname.Default.(string)
+	// wpchatroommemberDescAvatar is the schema descriptor for avatar field.
+	wpchatroommemberDescAvatar := wpchatroommemberFields[3].Descriptor()
+	// wpchatroommember.DefaultAvatar holds the default value on creation for the avatar field.
+	wpchatroommember.DefaultAvatar = wpchatroommemberDescAvatar.Default.(string)
 	wxMixin := schema.Wx{}.Mixin()
 	wxMixinHooks2 := wxMixin[2].Hooks()
 	wx.Hooks[0] = wxMixinHooks2[0]

+ 60 - 0
ent/schema/wp_chatroom.go

@@ -0,0 +1,60 @@
+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"
+)
+
+type WpChatroom struct {
+	ent.Schema
+}
+
+func (WpChatroom) Fields() []ent.Field {
+	return []ent.Field{
+		field.String("wx_wxid").Default("").
+			Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("所属微信id"),
+		field.String("chatroom_id").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("群id"),
+		field.String("nickname").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("群昵称"),
+		field.String("owner").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("群主"),
+		field.String("avatar").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("群头像"),
+		field.JSON("member_list", []string{}).
+			Annotations(entsql.WithComments(true)).
+			Comment("群成员"),
+	}
+}
+
+func (WpChatroom) Mixin() []ent.Mixin {
+	return []ent.Mixin{
+		mixins.IDMixin{},
+		mixins.StatusMixin{},
+	}
+}
+
+func (WpChatroom) Indexes() []ent.Index {
+	return []ent.Index{
+		index.Fields("wx_wxid", "chatroom_id"),
+	}
+}
+
+func (WpChatroom) Edges() []ent.Edge { return []ent.Edge{} }
+
+func (WpChatroom) Annotations() []schema.Annotation {
+	return []schema.Annotation{
+		entsql.WithComments(true),
+		entsql.Annotation{Table: "wp_chatroom"},
+	}
+}

+ 54 - 0
ent/schema/wp_chatroom_member.go

@@ -0,0 +1,54 @@
+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"
+)
+
+type WpChatroomMember struct {
+	ent.Schema
+}
+
+func (WpChatroomMember) Fields() []ent.Field {
+	return []ent.Field{
+		field.String("wx_wxid").Default("").
+			Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("所属微信id"),
+		field.String("wxid").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("微信id"),
+		field.String("nickname").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("群昵称"),
+		field.String("avatar").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("群头像"),
+	}
+}
+
+func (WpChatroomMember) Mixin() []ent.Mixin {
+	return []ent.Mixin{
+		mixins.IDMixin{},
+		mixins.StatusMixin{},
+	}
+}
+
+func (WpChatroomMember) Indexes() []ent.Index {
+	return []ent.Index{
+		index.Fields("wx_wxid", "wxid"),
+	}
+}
+
+func (WpChatroomMember) Edges() []ent.Edge { return []ent.Edge{} }
+
+func (WpChatroomMember) Annotations() []schema.Annotation {
+	return []schema.Annotation{
+		entsql.WithComments(true),
+		entsql.Annotation{Table: "wp_chatroom_member"},
+	}
+}

+ 336 - 0
ent/set_not_nil.go

@@ -5864,6 +5864,342 @@ func (we *WorkExperienceCreate) SetNotNilOrganizationID(value *uint64) *WorkExpe
 }
 
 // set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilUpdatedAt(value *time.Time) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetUpdatedAt(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilUpdatedAt(value *time.Time) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetUpdatedAt(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilUpdatedAt(value *time.Time) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetUpdatedAt(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilStatus(value *uint8) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetStatus(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilStatus(value *uint8) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetStatus(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilStatus(value *uint8) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetStatus(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilWxWxid(value *string) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetWxWxid(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilWxWxid(value *string) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetWxWxid(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilWxWxid(value *string) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetWxWxid(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilChatroomID(value *string) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetChatroomID(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilChatroomID(value *string) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetChatroomID(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilChatroomID(value *string) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetChatroomID(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilNickname(value *string) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetNickname(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilNickname(value *string) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetNickname(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilNickname(value *string) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetNickname(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilOwner(value *string) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetOwner(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilOwner(value *string) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetOwner(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilOwner(value *string) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetOwner(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilAvatar(value *string) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetAvatar(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilAvatar(value *string) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetAvatar(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilAvatar(value *string) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetAvatar(*value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdate) SetNotNilMemberList(value []string) *WpChatroomUpdate {
+	if value != nil {
+		return wc.SetMemberList(value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomUpdateOne) SetNotNilMemberList(value []string) *WpChatroomUpdateOne {
+	if value != nil {
+		return wc.SetMemberList(value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wc *WpChatroomCreate) SetNotNilMemberList(value []string) *WpChatroomCreate {
+	if value != nil {
+		return wc.SetMemberList(value)
+	}
+	return wc
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdate) SetNotNilUpdatedAt(value *time.Time) *WpChatroomMemberUpdate {
+	if value != nil {
+		return wcm.SetUpdatedAt(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdateOne) SetNotNilUpdatedAt(value *time.Time) *WpChatroomMemberUpdateOne {
+	if value != nil {
+		return wcm.SetUpdatedAt(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberCreate) SetNotNilUpdatedAt(value *time.Time) *WpChatroomMemberCreate {
+	if value != nil {
+		return wcm.SetUpdatedAt(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdate) SetNotNilStatus(value *uint8) *WpChatroomMemberUpdate {
+	if value != nil {
+		return wcm.SetStatus(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdateOne) SetNotNilStatus(value *uint8) *WpChatroomMemberUpdateOne {
+	if value != nil {
+		return wcm.SetStatus(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberCreate) SetNotNilStatus(value *uint8) *WpChatroomMemberCreate {
+	if value != nil {
+		return wcm.SetStatus(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdate) SetNotNilWxWxid(value *string) *WpChatroomMemberUpdate {
+	if value != nil {
+		return wcm.SetWxWxid(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdateOne) SetNotNilWxWxid(value *string) *WpChatroomMemberUpdateOne {
+	if value != nil {
+		return wcm.SetWxWxid(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberCreate) SetNotNilWxWxid(value *string) *WpChatroomMemberCreate {
+	if value != nil {
+		return wcm.SetWxWxid(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdate) SetNotNilWxid(value *string) *WpChatroomMemberUpdate {
+	if value != nil {
+		return wcm.SetWxid(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdateOne) SetNotNilWxid(value *string) *WpChatroomMemberUpdateOne {
+	if value != nil {
+		return wcm.SetWxid(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberCreate) SetNotNilWxid(value *string) *WpChatroomMemberCreate {
+	if value != nil {
+		return wcm.SetWxid(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdate) SetNotNilNickname(value *string) *WpChatroomMemberUpdate {
+	if value != nil {
+		return wcm.SetNickname(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdateOne) SetNotNilNickname(value *string) *WpChatroomMemberUpdateOne {
+	if value != nil {
+		return wcm.SetNickname(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberCreate) SetNotNilNickname(value *string) *WpChatroomMemberCreate {
+	if value != nil {
+		return wcm.SetNickname(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdate) SetNotNilAvatar(value *string) *WpChatroomMemberUpdate {
+	if value != nil {
+		return wcm.SetAvatar(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberUpdateOne) SetNotNilAvatar(value *string) *WpChatroomMemberUpdateOne {
+	if value != nil {
+		return wcm.SetAvatar(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
+func (wcm *WpChatroomMemberCreate) SetNotNilAvatar(value *string) *WpChatroomMemberCreate {
+	if value != nil {
+		return wcm.SetAvatar(*value)
+	}
+	return wcm
+}
+
+// set field if value's pointer is not nil.
 func (w *WxUpdate) SetNotNilUpdatedAt(value *time.Time) *WxUpdate {
 	if value != nil {
 		return w.SetUpdatedAt(*value)

+ 6 - 0
ent/tx.go

@@ -62,6 +62,10 @@ type Tx struct {
 	UsageTotal *UsageTotalClient
 	// WorkExperience is the client for interacting with the WorkExperience builders.
 	WorkExperience *WorkExperienceClient
+	// WpChatroom is the client for interacting with the WpChatroom builders.
+	WpChatroom *WpChatroomClient
+	// WpChatroomMember is the client for interacting with the WpChatroomMember builders.
+	WpChatroomMember *WpChatroomMemberClient
 	// Wx is the client for interacting with the Wx builders.
 	Wx *WxClient
 	// WxCard is the client for interacting with the WxCard builders.
@@ -225,6 +229,8 @@ func (tx *Tx) init() {
 	tx.UsageDetail = NewUsageDetailClient(tx.config)
 	tx.UsageTotal = NewUsageTotalClient(tx.config)
 	tx.WorkExperience = NewWorkExperienceClient(tx.config)
+	tx.WpChatroom = NewWpChatroomClient(tx.config)
+	tx.WpChatroomMember = NewWpChatroomMemberClient(tx.config)
 	tx.Wx = NewWxClient(tx.config)
 	tx.WxCard = NewWxCardClient(tx.config)
 	tx.WxCardUser = NewWxCardUserClient(tx.config)

+ 199 - 0
ent/wpchatroom.go

@@ -0,0 +1,199 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"encoding/json"
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/wpchatroom"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// WpChatroom is the model entity for the WpChatroom schema.
+type WpChatroom struct {
+	config `json:"-"`
+	// ID of the ent.
+	ID uint64 `json:"id,omitempty"`
+	// Create Time | 创建日期
+	CreatedAt time.Time `json:"created_at,omitempty"`
+	// Update Time | 修改日期
+	UpdatedAt time.Time `json:"updated_at,omitempty"`
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status uint8 `json:"status,omitempty"`
+	// 所属微信id
+	WxWxid string `json:"wx_wxid,omitempty"`
+	// 群id
+	ChatroomID string `json:"chatroom_id,omitempty"`
+	// 群昵称
+	Nickname string `json:"nickname,omitempty"`
+	// 群主
+	Owner string `json:"owner,omitempty"`
+	// 群头像
+	Avatar string `json:"avatar,omitempty"`
+	// 群成员
+	MemberList   []string `json:"member_list,omitempty"`
+	selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*WpChatroom) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case wpchatroom.FieldMemberList:
+			values[i] = new([]byte)
+		case wpchatroom.FieldID, wpchatroom.FieldStatus:
+			values[i] = new(sql.NullInt64)
+		case wpchatroom.FieldWxWxid, wpchatroom.FieldChatroomID, wpchatroom.FieldNickname, wpchatroom.FieldOwner, wpchatroom.FieldAvatar:
+			values[i] = new(sql.NullString)
+		case wpchatroom.FieldCreatedAt, wpchatroom.FieldUpdatedAt:
+			values[i] = new(sql.NullTime)
+		default:
+			values[i] = new(sql.UnknownType)
+		}
+	}
+	return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the WpChatroom fields.
+func (wc *WpChatroom) assignValues(columns []string, values []any) error {
+	if m, n := len(values), len(columns); m < n {
+		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+	}
+	for i := range columns {
+		switch columns[i] {
+		case wpchatroom.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			wc.ID = uint64(value.Int64)
+		case wpchatroom.FieldCreatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field created_at", values[i])
+			} else if value.Valid {
+				wc.CreatedAt = value.Time
+			}
+		case wpchatroom.FieldUpdatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+			} else if value.Valid {
+				wc.UpdatedAt = value.Time
+			}
+		case wpchatroom.FieldStatus:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field status", values[i])
+			} else if value.Valid {
+				wc.Status = uint8(value.Int64)
+			}
+		case wpchatroom.FieldWxWxid:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field wx_wxid", values[i])
+			} else if value.Valid {
+				wc.WxWxid = value.String
+			}
+		case wpchatroom.FieldChatroomID:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field chatroom_id", values[i])
+			} else if value.Valid {
+				wc.ChatroomID = value.String
+			}
+		case wpchatroom.FieldNickname:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field nickname", values[i])
+			} else if value.Valid {
+				wc.Nickname = value.String
+			}
+		case wpchatroom.FieldOwner:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field owner", values[i])
+			} else if value.Valid {
+				wc.Owner = value.String
+			}
+		case wpchatroom.FieldAvatar:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field avatar", values[i])
+			} else if value.Valid {
+				wc.Avatar = value.String
+			}
+		case wpchatroom.FieldMemberList:
+			if value, ok := values[i].(*[]byte); !ok {
+				return fmt.Errorf("unexpected type %T for field member_list", values[i])
+			} else if value != nil && len(*value) > 0 {
+				if err := json.Unmarshal(*value, &wc.MemberList); err != nil {
+					return fmt.Errorf("unmarshal field member_list: %w", err)
+				}
+			}
+		default:
+			wc.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the WpChatroom.
+// This includes values selected through modifiers, order, etc.
+func (wc *WpChatroom) Value(name string) (ent.Value, error) {
+	return wc.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this WpChatroom.
+// Note that you need to call WpChatroom.Unwrap() before calling this method if this WpChatroom
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (wc *WpChatroom) Update() *WpChatroomUpdateOne {
+	return NewWpChatroomClient(wc.config).UpdateOne(wc)
+}
+
+// Unwrap unwraps the WpChatroom entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (wc *WpChatroom) Unwrap() *WpChatroom {
+	_tx, ok := wc.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: WpChatroom is not a transactional entity")
+	}
+	wc.config.driver = _tx.drv
+	return wc
+}
+
+// String implements the fmt.Stringer.
+func (wc *WpChatroom) String() string {
+	var builder strings.Builder
+	builder.WriteString("WpChatroom(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", wc.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(wc.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(wc.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("status=")
+	builder.WriteString(fmt.Sprintf("%v", wc.Status))
+	builder.WriteString(", ")
+	builder.WriteString("wx_wxid=")
+	builder.WriteString(wc.WxWxid)
+	builder.WriteString(", ")
+	builder.WriteString("chatroom_id=")
+	builder.WriteString(wc.ChatroomID)
+	builder.WriteString(", ")
+	builder.WriteString("nickname=")
+	builder.WriteString(wc.Nickname)
+	builder.WriteString(", ")
+	builder.WriteString("owner=")
+	builder.WriteString(wc.Owner)
+	builder.WriteString(", ")
+	builder.WriteString("avatar=")
+	builder.WriteString(wc.Avatar)
+	builder.WriteString(", ")
+	builder.WriteString("member_list=")
+	builder.WriteString(fmt.Sprintf("%v", wc.MemberList))
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// WpChatrooms is a parsable slice of WpChatroom.
+type WpChatrooms []*WpChatroom

+ 565 - 0
ent/wpchatroom/where.go

@@ -0,0 +1,565 @@
+// Code generated by ent, DO NOT EDIT.
+
+package wpchatroom
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldStatus, v))
+}
+
+// WxWxid applies equality check predicate on the "wx_wxid" field. It's identical to WxWxidEQ.
+func WxWxid(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldWxWxid, v))
+}
+
+// ChatroomID applies equality check predicate on the "chatroom_id" field. It's identical to ChatroomIDEQ.
+func ChatroomID(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldChatroomID, v))
+}
+
+// Nickname applies equality check predicate on the "nickname" field. It's identical to NicknameEQ.
+func Nickname(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldNickname, v))
+}
+
+// Owner applies equality check predicate on the "owner" field. It's identical to OwnerEQ.
+func Owner(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldOwner, v))
+}
+
+// Avatar applies equality check predicate on the "avatar" field. It's identical to AvatarEQ.
+func Avatar(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldAvatar, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v uint8) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusIsNil applies the IsNil predicate on the "status" field.
+func StatusIsNil() predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIsNull(FieldStatus))
+}
+
+// StatusNotNil applies the NotNil predicate on the "status" field.
+func StatusNotNil() predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotNull(FieldStatus))
+}
+
+// WxWxidEQ applies the EQ predicate on the "wx_wxid" field.
+func WxWxidEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldWxWxid, v))
+}
+
+// WxWxidNEQ applies the NEQ predicate on the "wx_wxid" field.
+func WxWxidNEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldWxWxid, v))
+}
+
+// WxWxidIn applies the In predicate on the "wx_wxid" field.
+func WxWxidIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldWxWxid, vs...))
+}
+
+// WxWxidNotIn applies the NotIn predicate on the "wx_wxid" field.
+func WxWxidNotIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldWxWxid, vs...))
+}
+
+// WxWxidGT applies the GT predicate on the "wx_wxid" field.
+func WxWxidGT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldWxWxid, v))
+}
+
+// WxWxidGTE applies the GTE predicate on the "wx_wxid" field.
+func WxWxidGTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldWxWxid, v))
+}
+
+// WxWxidLT applies the LT predicate on the "wx_wxid" field.
+func WxWxidLT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldWxWxid, v))
+}
+
+// WxWxidLTE applies the LTE predicate on the "wx_wxid" field.
+func WxWxidLTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldWxWxid, v))
+}
+
+// WxWxidContains applies the Contains predicate on the "wx_wxid" field.
+func WxWxidContains(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContains(FieldWxWxid, v))
+}
+
+// WxWxidHasPrefix applies the HasPrefix predicate on the "wx_wxid" field.
+func WxWxidHasPrefix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasPrefix(FieldWxWxid, v))
+}
+
+// WxWxidHasSuffix applies the HasSuffix predicate on the "wx_wxid" field.
+func WxWxidHasSuffix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasSuffix(FieldWxWxid, v))
+}
+
+// WxWxidEqualFold applies the EqualFold predicate on the "wx_wxid" field.
+func WxWxidEqualFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEqualFold(FieldWxWxid, v))
+}
+
+// WxWxidContainsFold applies the ContainsFold predicate on the "wx_wxid" field.
+func WxWxidContainsFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContainsFold(FieldWxWxid, v))
+}
+
+// ChatroomIDEQ applies the EQ predicate on the "chatroom_id" field.
+func ChatroomIDEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldChatroomID, v))
+}
+
+// ChatroomIDNEQ applies the NEQ predicate on the "chatroom_id" field.
+func ChatroomIDNEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldChatroomID, v))
+}
+
+// ChatroomIDIn applies the In predicate on the "chatroom_id" field.
+func ChatroomIDIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldChatroomID, vs...))
+}
+
+// ChatroomIDNotIn applies the NotIn predicate on the "chatroom_id" field.
+func ChatroomIDNotIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldChatroomID, vs...))
+}
+
+// ChatroomIDGT applies the GT predicate on the "chatroom_id" field.
+func ChatroomIDGT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldChatroomID, v))
+}
+
+// ChatroomIDGTE applies the GTE predicate on the "chatroom_id" field.
+func ChatroomIDGTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldChatroomID, v))
+}
+
+// ChatroomIDLT applies the LT predicate on the "chatroom_id" field.
+func ChatroomIDLT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldChatroomID, v))
+}
+
+// ChatroomIDLTE applies the LTE predicate on the "chatroom_id" field.
+func ChatroomIDLTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldChatroomID, v))
+}
+
+// ChatroomIDContains applies the Contains predicate on the "chatroom_id" field.
+func ChatroomIDContains(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContains(FieldChatroomID, v))
+}
+
+// ChatroomIDHasPrefix applies the HasPrefix predicate on the "chatroom_id" field.
+func ChatroomIDHasPrefix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasPrefix(FieldChatroomID, v))
+}
+
+// ChatroomIDHasSuffix applies the HasSuffix predicate on the "chatroom_id" field.
+func ChatroomIDHasSuffix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasSuffix(FieldChatroomID, v))
+}
+
+// ChatroomIDEqualFold applies the EqualFold predicate on the "chatroom_id" field.
+func ChatroomIDEqualFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEqualFold(FieldChatroomID, v))
+}
+
+// ChatroomIDContainsFold applies the ContainsFold predicate on the "chatroom_id" field.
+func ChatroomIDContainsFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContainsFold(FieldChatroomID, v))
+}
+
+// NicknameEQ applies the EQ predicate on the "nickname" field.
+func NicknameEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldNickname, v))
+}
+
+// NicknameNEQ applies the NEQ predicate on the "nickname" field.
+func NicknameNEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldNickname, v))
+}
+
+// NicknameIn applies the In predicate on the "nickname" field.
+func NicknameIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldNickname, vs...))
+}
+
+// NicknameNotIn applies the NotIn predicate on the "nickname" field.
+func NicknameNotIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldNickname, vs...))
+}
+
+// NicknameGT applies the GT predicate on the "nickname" field.
+func NicknameGT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldNickname, v))
+}
+
+// NicknameGTE applies the GTE predicate on the "nickname" field.
+func NicknameGTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldNickname, v))
+}
+
+// NicknameLT applies the LT predicate on the "nickname" field.
+func NicknameLT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldNickname, v))
+}
+
+// NicknameLTE applies the LTE predicate on the "nickname" field.
+func NicknameLTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldNickname, v))
+}
+
+// NicknameContains applies the Contains predicate on the "nickname" field.
+func NicknameContains(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContains(FieldNickname, v))
+}
+
+// NicknameHasPrefix applies the HasPrefix predicate on the "nickname" field.
+func NicknameHasPrefix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasPrefix(FieldNickname, v))
+}
+
+// NicknameHasSuffix applies the HasSuffix predicate on the "nickname" field.
+func NicknameHasSuffix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasSuffix(FieldNickname, v))
+}
+
+// NicknameEqualFold applies the EqualFold predicate on the "nickname" field.
+func NicknameEqualFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEqualFold(FieldNickname, v))
+}
+
+// NicknameContainsFold applies the ContainsFold predicate on the "nickname" field.
+func NicknameContainsFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContainsFold(FieldNickname, v))
+}
+
+// OwnerEQ applies the EQ predicate on the "owner" field.
+func OwnerEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldOwner, v))
+}
+
+// OwnerNEQ applies the NEQ predicate on the "owner" field.
+func OwnerNEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldOwner, v))
+}
+
+// OwnerIn applies the In predicate on the "owner" field.
+func OwnerIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldOwner, vs...))
+}
+
+// OwnerNotIn applies the NotIn predicate on the "owner" field.
+func OwnerNotIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldOwner, vs...))
+}
+
+// OwnerGT applies the GT predicate on the "owner" field.
+func OwnerGT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldOwner, v))
+}
+
+// OwnerGTE applies the GTE predicate on the "owner" field.
+func OwnerGTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldOwner, v))
+}
+
+// OwnerLT applies the LT predicate on the "owner" field.
+func OwnerLT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldOwner, v))
+}
+
+// OwnerLTE applies the LTE predicate on the "owner" field.
+func OwnerLTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldOwner, v))
+}
+
+// OwnerContains applies the Contains predicate on the "owner" field.
+func OwnerContains(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContains(FieldOwner, v))
+}
+
+// OwnerHasPrefix applies the HasPrefix predicate on the "owner" field.
+func OwnerHasPrefix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasPrefix(FieldOwner, v))
+}
+
+// OwnerHasSuffix applies the HasSuffix predicate on the "owner" field.
+func OwnerHasSuffix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasSuffix(FieldOwner, v))
+}
+
+// OwnerEqualFold applies the EqualFold predicate on the "owner" field.
+func OwnerEqualFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEqualFold(FieldOwner, v))
+}
+
+// OwnerContainsFold applies the ContainsFold predicate on the "owner" field.
+func OwnerContainsFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContainsFold(FieldOwner, v))
+}
+
+// AvatarEQ applies the EQ predicate on the "avatar" field.
+func AvatarEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEQ(FieldAvatar, v))
+}
+
+// AvatarNEQ applies the NEQ predicate on the "avatar" field.
+func AvatarNEQ(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNEQ(FieldAvatar, v))
+}
+
+// AvatarIn applies the In predicate on the "avatar" field.
+func AvatarIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldIn(FieldAvatar, vs...))
+}
+
+// AvatarNotIn applies the NotIn predicate on the "avatar" field.
+func AvatarNotIn(vs ...string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldNotIn(FieldAvatar, vs...))
+}
+
+// AvatarGT applies the GT predicate on the "avatar" field.
+func AvatarGT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGT(FieldAvatar, v))
+}
+
+// AvatarGTE applies the GTE predicate on the "avatar" field.
+func AvatarGTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldGTE(FieldAvatar, v))
+}
+
+// AvatarLT applies the LT predicate on the "avatar" field.
+func AvatarLT(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLT(FieldAvatar, v))
+}
+
+// AvatarLTE applies the LTE predicate on the "avatar" field.
+func AvatarLTE(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldLTE(FieldAvatar, v))
+}
+
+// AvatarContains applies the Contains predicate on the "avatar" field.
+func AvatarContains(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContains(FieldAvatar, v))
+}
+
+// AvatarHasPrefix applies the HasPrefix predicate on the "avatar" field.
+func AvatarHasPrefix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasPrefix(FieldAvatar, v))
+}
+
+// AvatarHasSuffix applies the HasSuffix predicate on the "avatar" field.
+func AvatarHasSuffix(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldHasSuffix(FieldAvatar, v))
+}
+
+// AvatarEqualFold applies the EqualFold predicate on the "avatar" field.
+func AvatarEqualFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldEqualFold(FieldAvatar, v))
+}
+
+// AvatarContainsFold applies the ContainsFold predicate on the "avatar" field.
+func AvatarContainsFold(v string) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.FieldContainsFold(FieldAvatar, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.WpChatroom) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.WpChatroom) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.WpChatroom) predicate.WpChatroom {
+	return predicate.WpChatroom(sql.NotPredicates(p))
+}

+ 129 - 0
ent/wpchatroom/wpchatroom.go

@@ -0,0 +1,129 @@
+// Code generated by ent, DO NOT EDIT.
+
+package wpchatroom
+
+import (
+	"time"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the wpchatroom type in the database.
+	Label = "wp_chatroom"
+	// FieldID holds the string denoting the id field in the database.
+	FieldID = "id"
+	// FieldCreatedAt holds the string denoting the created_at field in the database.
+	FieldCreatedAt = "created_at"
+	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
+	FieldUpdatedAt = "updated_at"
+	// FieldStatus holds the string denoting the status field in the database.
+	FieldStatus = "status"
+	// FieldWxWxid holds the string denoting the wx_wxid field in the database.
+	FieldWxWxid = "wx_wxid"
+	// FieldChatroomID holds the string denoting the chatroom_id field in the database.
+	FieldChatroomID = "chatroom_id"
+	// FieldNickname holds the string denoting the nickname field in the database.
+	FieldNickname = "nickname"
+	// FieldOwner holds the string denoting the owner field in the database.
+	FieldOwner = "owner"
+	// FieldAvatar holds the string denoting the avatar field in the database.
+	FieldAvatar = "avatar"
+	// FieldMemberList holds the string denoting the member_list field in the database.
+	FieldMemberList = "member_list"
+	// Table holds the table name of the wpchatroom in the database.
+	Table = "wp_chatroom"
+)
+
+// Columns holds all SQL columns for wpchatroom fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldStatus,
+	FieldWxWxid,
+	FieldChatroomID,
+	FieldNickname,
+	FieldOwner,
+	FieldAvatar,
+	FieldMemberList,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+	for i := range Columns {
+		if column == Columns[i] {
+			return true
+		}
+	}
+	return false
+}
+
+var (
+	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
+	DefaultCreatedAt func() time.Time
+	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+	DefaultUpdatedAt func() time.Time
+	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+	UpdateDefaultUpdatedAt func() time.Time
+	// DefaultStatus holds the default value on creation for the "status" field.
+	DefaultStatus uint8
+	// DefaultWxWxid holds the default value on creation for the "wx_wxid" field.
+	DefaultWxWxid string
+	// DefaultChatroomID holds the default value on creation for the "chatroom_id" field.
+	DefaultChatroomID string
+	// DefaultNickname holds the default value on creation for the "nickname" field.
+	DefaultNickname string
+	// DefaultOwner holds the default value on creation for the "owner" field.
+	DefaultOwner string
+	// DefaultAvatar holds the default value on creation for the "avatar" field.
+	DefaultAvatar string
+)
+
+// OrderOption defines the ordering options for the WpChatroom queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByWxWxid orders the results by the wx_wxid field.
+func ByWxWxid(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldWxWxid, opts...).ToFunc()
+}
+
+// ByChatroomID orders the results by the chatroom_id field.
+func ByChatroomID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldChatroomID, opts...).ToFunc()
+}
+
+// ByNickname orders the results by the nickname field.
+func ByNickname(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldNickname, opts...).ToFunc()
+}
+
+// ByOwner orders the results by the owner field.
+func ByOwner(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldOwner, opts...).ToFunc()
+}
+
+// ByAvatar orders the results by the avatar field.
+func ByAvatar(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAvatar, opts...).ToFunc()
+}

+ 1014 - 0
ent/wpchatroom_create.go

@@ -0,0 +1,1014 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/wpchatroom"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomCreate is the builder for creating a WpChatroom entity.
+type WpChatroomCreate struct {
+	config
+	mutation *WpChatroomMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (wcc *WpChatroomCreate) SetCreatedAt(t time.Time) *WpChatroomCreate {
+	wcc.mutation.SetCreatedAt(t)
+	return wcc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableCreatedAt(t *time.Time) *WpChatroomCreate {
+	if t != nil {
+		wcc.SetCreatedAt(*t)
+	}
+	return wcc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (wcc *WpChatroomCreate) SetUpdatedAt(t time.Time) *WpChatroomCreate {
+	wcc.mutation.SetUpdatedAt(t)
+	return wcc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableUpdatedAt(t *time.Time) *WpChatroomCreate {
+	if t != nil {
+		wcc.SetUpdatedAt(*t)
+	}
+	return wcc
+}
+
+// SetStatus sets the "status" field.
+func (wcc *WpChatroomCreate) SetStatus(u uint8) *WpChatroomCreate {
+	wcc.mutation.SetStatus(u)
+	return wcc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableStatus(u *uint8) *WpChatroomCreate {
+	if u != nil {
+		wcc.SetStatus(*u)
+	}
+	return wcc
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (wcc *WpChatroomCreate) SetWxWxid(s string) *WpChatroomCreate {
+	wcc.mutation.SetWxWxid(s)
+	return wcc
+}
+
+// SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableWxWxid(s *string) *WpChatroomCreate {
+	if s != nil {
+		wcc.SetWxWxid(*s)
+	}
+	return wcc
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (wcc *WpChatroomCreate) SetChatroomID(s string) *WpChatroomCreate {
+	wcc.mutation.SetChatroomID(s)
+	return wcc
+}
+
+// SetNillableChatroomID sets the "chatroom_id" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableChatroomID(s *string) *WpChatroomCreate {
+	if s != nil {
+		wcc.SetChatroomID(*s)
+	}
+	return wcc
+}
+
+// SetNickname sets the "nickname" field.
+func (wcc *WpChatroomCreate) SetNickname(s string) *WpChatroomCreate {
+	wcc.mutation.SetNickname(s)
+	return wcc
+}
+
+// SetNillableNickname sets the "nickname" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableNickname(s *string) *WpChatroomCreate {
+	if s != nil {
+		wcc.SetNickname(*s)
+	}
+	return wcc
+}
+
+// SetOwner sets the "owner" field.
+func (wcc *WpChatroomCreate) SetOwner(s string) *WpChatroomCreate {
+	wcc.mutation.SetOwner(s)
+	return wcc
+}
+
+// SetNillableOwner sets the "owner" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableOwner(s *string) *WpChatroomCreate {
+	if s != nil {
+		wcc.SetOwner(*s)
+	}
+	return wcc
+}
+
+// SetAvatar sets the "avatar" field.
+func (wcc *WpChatroomCreate) SetAvatar(s string) *WpChatroomCreate {
+	wcc.mutation.SetAvatar(s)
+	return wcc
+}
+
+// SetNillableAvatar sets the "avatar" field if the given value is not nil.
+func (wcc *WpChatroomCreate) SetNillableAvatar(s *string) *WpChatroomCreate {
+	if s != nil {
+		wcc.SetAvatar(*s)
+	}
+	return wcc
+}
+
+// SetMemberList sets the "member_list" field.
+func (wcc *WpChatroomCreate) SetMemberList(s []string) *WpChatroomCreate {
+	wcc.mutation.SetMemberList(s)
+	return wcc
+}
+
+// SetID sets the "id" field.
+func (wcc *WpChatroomCreate) SetID(u uint64) *WpChatroomCreate {
+	wcc.mutation.SetID(u)
+	return wcc
+}
+
+// Mutation returns the WpChatroomMutation object of the builder.
+func (wcc *WpChatroomCreate) Mutation() *WpChatroomMutation {
+	return wcc.mutation
+}
+
+// Save creates the WpChatroom in the database.
+func (wcc *WpChatroomCreate) Save(ctx context.Context) (*WpChatroom, error) {
+	wcc.defaults()
+	return withHooks(ctx, wcc.sqlSave, wcc.mutation, wcc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (wcc *WpChatroomCreate) SaveX(ctx context.Context) *WpChatroom {
+	v, err := wcc.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (wcc *WpChatroomCreate) Exec(ctx context.Context) error {
+	_, err := wcc.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcc *WpChatroomCreate) ExecX(ctx context.Context) {
+	if err := wcc.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (wcc *WpChatroomCreate) defaults() {
+	if _, ok := wcc.mutation.CreatedAt(); !ok {
+		v := wpchatroom.DefaultCreatedAt()
+		wcc.mutation.SetCreatedAt(v)
+	}
+	if _, ok := wcc.mutation.UpdatedAt(); !ok {
+		v := wpchatroom.DefaultUpdatedAt()
+		wcc.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := wcc.mutation.Status(); !ok {
+		v := wpchatroom.DefaultStatus
+		wcc.mutation.SetStatus(v)
+	}
+	if _, ok := wcc.mutation.WxWxid(); !ok {
+		v := wpchatroom.DefaultWxWxid
+		wcc.mutation.SetWxWxid(v)
+	}
+	if _, ok := wcc.mutation.ChatroomID(); !ok {
+		v := wpchatroom.DefaultChatroomID
+		wcc.mutation.SetChatroomID(v)
+	}
+	if _, ok := wcc.mutation.Nickname(); !ok {
+		v := wpchatroom.DefaultNickname
+		wcc.mutation.SetNickname(v)
+	}
+	if _, ok := wcc.mutation.Owner(); !ok {
+		v := wpchatroom.DefaultOwner
+		wcc.mutation.SetOwner(v)
+	}
+	if _, ok := wcc.mutation.Avatar(); !ok {
+		v := wpchatroom.DefaultAvatar
+		wcc.mutation.SetAvatar(v)
+	}
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (wcc *WpChatroomCreate) check() error {
+	if _, ok := wcc.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "WpChatroom.created_at"`)}
+	}
+	if _, ok := wcc.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "WpChatroom.updated_at"`)}
+	}
+	if _, ok := wcc.mutation.WxWxid(); !ok {
+		return &ValidationError{Name: "wx_wxid", err: errors.New(`ent: missing required field "WpChatroom.wx_wxid"`)}
+	}
+	if _, ok := wcc.mutation.ChatroomID(); !ok {
+		return &ValidationError{Name: "chatroom_id", err: errors.New(`ent: missing required field "WpChatroom.chatroom_id"`)}
+	}
+	if _, ok := wcc.mutation.Nickname(); !ok {
+		return &ValidationError{Name: "nickname", err: errors.New(`ent: missing required field "WpChatroom.nickname"`)}
+	}
+	if _, ok := wcc.mutation.Owner(); !ok {
+		return &ValidationError{Name: "owner", err: errors.New(`ent: missing required field "WpChatroom.owner"`)}
+	}
+	if _, ok := wcc.mutation.Avatar(); !ok {
+		return &ValidationError{Name: "avatar", err: errors.New(`ent: missing required field "WpChatroom.avatar"`)}
+	}
+	if _, ok := wcc.mutation.MemberList(); !ok {
+		return &ValidationError{Name: "member_list", err: errors.New(`ent: missing required field "WpChatroom.member_list"`)}
+	}
+	return nil
+}
+
+func (wcc *WpChatroomCreate) sqlSave(ctx context.Context) (*WpChatroom, error) {
+	if err := wcc.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := wcc.createSpec()
+	if err := sqlgraph.CreateNode(ctx, wcc.driver, _spec); err != nil {
+		if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	if _spec.ID.Value != _node.ID {
+		id := _spec.ID.Value.(int64)
+		_node.ID = uint64(id)
+	}
+	wcc.mutation.id = &_node.ID
+	wcc.mutation.done = true
+	return _node, nil
+}
+
+func (wcc *WpChatroomCreate) createSpec() (*WpChatroom, *sqlgraph.CreateSpec) {
+	var (
+		_node = &WpChatroom{config: wcc.config}
+		_spec = sqlgraph.NewCreateSpec(wpchatroom.Table, sqlgraph.NewFieldSpec(wpchatroom.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = wcc.conflict
+	if id, ok := wcc.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := wcc.mutation.CreatedAt(); ok {
+		_spec.SetField(wpchatroom.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := wcc.mutation.UpdatedAt(); ok {
+		_spec.SetField(wpchatroom.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := wcc.mutation.Status(); ok {
+		_spec.SetField(wpchatroom.FieldStatus, field.TypeUint8, value)
+		_node.Status = value
+	}
+	if value, ok := wcc.mutation.WxWxid(); ok {
+		_spec.SetField(wpchatroom.FieldWxWxid, field.TypeString, value)
+		_node.WxWxid = value
+	}
+	if value, ok := wcc.mutation.ChatroomID(); ok {
+		_spec.SetField(wpchatroom.FieldChatroomID, field.TypeString, value)
+		_node.ChatroomID = value
+	}
+	if value, ok := wcc.mutation.Nickname(); ok {
+		_spec.SetField(wpchatroom.FieldNickname, field.TypeString, value)
+		_node.Nickname = value
+	}
+	if value, ok := wcc.mutation.Owner(); ok {
+		_spec.SetField(wpchatroom.FieldOwner, field.TypeString, value)
+		_node.Owner = value
+	}
+	if value, ok := wcc.mutation.Avatar(); ok {
+		_spec.SetField(wpchatroom.FieldAvatar, field.TypeString, value)
+		_node.Avatar = value
+	}
+	if value, ok := wcc.mutation.MemberList(); ok {
+		_spec.SetField(wpchatroom.FieldMemberList, field.TypeJSON, value)
+		_node.MemberList = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.WpChatroom.Create().
+//		SetCreatedAt(v).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.WpChatroomUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (wcc *WpChatroomCreate) OnConflict(opts ...sql.ConflictOption) *WpChatroomUpsertOne {
+	wcc.conflict = opts
+	return &WpChatroomUpsertOne{
+		create: wcc,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.WpChatroom.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (wcc *WpChatroomCreate) OnConflictColumns(columns ...string) *WpChatroomUpsertOne {
+	wcc.conflict = append(wcc.conflict, sql.ConflictColumns(columns...))
+	return &WpChatroomUpsertOne{
+		create: wcc,
+	}
+}
+
+type (
+	// WpChatroomUpsertOne is the builder for "upsert"-ing
+	//  one WpChatroom node.
+	WpChatroomUpsertOne struct {
+		create *WpChatroomCreate
+	}
+
+	// WpChatroomUpsert is the "OnConflict" setter.
+	WpChatroomUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *WpChatroomUpsert) SetUpdatedAt(v time.Time) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateUpdatedAt() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldUpdatedAt)
+	return u
+}
+
+// SetStatus sets the "status" field.
+func (u *WpChatroomUpsert) SetStatus(v uint8) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldStatus, v)
+	return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateStatus() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldStatus)
+	return u
+}
+
+// AddStatus adds v to the "status" field.
+func (u *WpChatroomUpsert) AddStatus(v uint8) *WpChatroomUpsert {
+	u.Add(wpchatroom.FieldStatus, v)
+	return u
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *WpChatroomUpsert) ClearStatus() *WpChatroomUpsert {
+	u.SetNull(wpchatroom.FieldStatus)
+	return u
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (u *WpChatroomUpsert) SetWxWxid(v string) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldWxWxid, v)
+	return u
+}
+
+// UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateWxWxid() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldWxWxid)
+	return u
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (u *WpChatroomUpsert) SetChatroomID(v string) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldChatroomID, v)
+	return u
+}
+
+// UpdateChatroomID sets the "chatroom_id" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateChatroomID() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldChatroomID)
+	return u
+}
+
+// SetNickname sets the "nickname" field.
+func (u *WpChatroomUpsert) SetNickname(v string) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldNickname, v)
+	return u
+}
+
+// UpdateNickname sets the "nickname" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateNickname() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldNickname)
+	return u
+}
+
+// SetOwner sets the "owner" field.
+func (u *WpChatroomUpsert) SetOwner(v string) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldOwner, v)
+	return u
+}
+
+// UpdateOwner sets the "owner" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateOwner() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldOwner)
+	return u
+}
+
+// SetAvatar sets the "avatar" field.
+func (u *WpChatroomUpsert) SetAvatar(v string) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldAvatar, v)
+	return u
+}
+
+// UpdateAvatar sets the "avatar" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateAvatar() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldAvatar)
+	return u
+}
+
+// SetMemberList sets the "member_list" field.
+func (u *WpChatroomUpsert) SetMemberList(v []string) *WpChatroomUpsert {
+	u.Set(wpchatroom.FieldMemberList, v)
+	return u
+}
+
+// UpdateMemberList sets the "member_list" field to the value that was provided on create.
+func (u *WpChatroomUpsert) UpdateMemberList() *WpChatroomUpsert {
+	u.SetExcluded(wpchatroom.FieldMemberList)
+	return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
+// Using this option is equivalent to using:
+//
+//	client.WpChatroom.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(wpchatroom.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *WpChatroomUpsertOne) UpdateNewValues() *WpChatroomUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		if _, exists := u.create.mutation.ID(); exists {
+			s.SetIgnore(wpchatroom.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(wpchatroom.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.WpChatroom.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *WpChatroomUpsertOne) Ignore() *WpChatroomUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *WpChatroomUpsertOne) DoNothing() *WpChatroomUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the WpChatroomCreate.OnConflict
+// documentation for more info.
+func (u *WpChatroomUpsertOne) Update(set func(*WpChatroomUpsert)) *WpChatroomUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&WpChatroomUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *WpChatroomUpsertOne) SetUpdatedAt(v time.Time) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateUpdatedAt() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *WpChatroomUpsertOne) SetStatus(v uint8) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *WpChatroomUpsertOne) AddStatus(v uint8) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateStatus() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *WpChatroomUpsertOne) ClearStatus() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (u *WpChatroomUpsertOne) SetWxWxid(v string) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetWxWxid(v)
+	})
+}
+
+// UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateWxWxid() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateWxWxid()
+	})
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (u *WpChatroomUpsertOne) SetChatroomID(v string) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetChatroomID(v)
+	})
+}
+
+// UpdateChatroomID sets the "chatroom_id" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateChatroomID() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateChatroomID()
+	})
+}
+
+// SetNickname sets the "nickname" field.
+func (u *WpChatroomUpsertOne) SetNickname(v string) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetNickname(v)
+	})
+}
+
+// UpdateNickname sets the "nickname" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateNickname() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateNickname()
+	})
+}
+
+// SetOwner sets the "owner" field.
+func (u *WpChatroomUpsertOne) SetOwner(v string) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetOwner(v)
+	})
+}
+
+// UpdateOwner sets the "owner" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateOwner() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateOwner()
+	})
+}
+
+// SetAvatar sets the "avatar" field.
+func (u *WpChatroomUpsertOne) SetAvatar(v string) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetAvatar(v)
+	})
+}
+
+// UpdateAvatar sets the "avatar" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateAvatar() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateAvatar()
+	})
+}
+
+// SetMemberList sets the "member_list" field.
+func (u *WpChatroomUpsertOne) SetMemberList(v []string) *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetMemberList(v)
+	})
+}
+
+// UpdateMemberList sets the "member_list" field to the value that was provided on create.
+func (u *WpChatroomUpsertOne) UpdateMemberList() *WpChatroomUpsertOne {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateMemberList()
+	})
+}
+
+// Exec executes the query.
+func (u *WpChatroomUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for WpChatroomCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *WpChatroomUpsertOne) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *WpChatroomUpsertOne) ID(ctx context.Context) (id uint64, err error) {
+	node, err := u.create.Save(ctx)
+	if err != nil {
+		return id, err
+	}
+	return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *WpChatroomUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// WpChatroomCreateBulk is the builder for creating many WpChatroom entities in bulk.
+type WpChatroomCreateBulk struct {
+	config
+	err      error
+	builders []*WpChatroomCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the WpChatroom entities in the database.
+func (wccb *WpChatroomCreateBulk) Save(ctx context.Context) ([]*WpChatroom, error) {
+	if wccb.err != nil {
+		return nil, wccb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(wccb.builders))
+	nodes := make([]*WpChatroom, len(wccb.builders))
+	mutators := make([]Mutator, len(wccb.builders))
+	for i := range wccb.builders {
+		func(i int, root context.Context) {
+			builder := wccb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*WpChatroomMutation)
+				if !ok {
+					return nil, fmt.Errorf("unexpected mutation type %T", m)
+				}
+				if err := builder.check(); err != nil {
+					return nil, err
+				}
+				builder.mutation = mutation
+				var err error
+				nodes[i], specs[i] = builder.createSpec()
+				if i < len(mutators)-1 {
+					_, err = mutators[i+1].Mutate(root, wccb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = wccb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, wccb.driver, spec); err != nil {
+						if sqlgraph.IsConstraintError(err) {
+							err = &ConstraintError{msg: err.Error(), wrap: err}
+						}
+					}
+				}
+				if err != nil {
+					return nil, err
+				}
+				mutation.id = &nodes[i].ID
+				if specs[i].ID.Value != nil && nodes[i].ID == 0 {
+					id := specs[i].ID.Value.(int64)
+					nodes[i].ID = uint64(id)
+				}
+				mutation.done = true
+				return nodes[i], nil
+			})
+			for i := len(builder.hooks) - 1; i >= 0; i-- {
+				mut = builder.hooks[i](mut)
+			}
+			mutators[i] = mut
+		}(i, ctx)
+	}
+	if len(mutators) > 0 {
+		if _, err := mutators[0].Mutate(ctx, wccb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (wccb *WpChatroomCreateBulk) SaveX(ctx context.Context) []*WpChatroom {
+	v, err := wccb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (wccb *WpChatroomCreateBulk) Exec(ctx context.Context) error {
+	_, err := wccb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wccb *WpChatroomCreateBulk) ExecX(ctx context.Context) {
+	if err := wccb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.WpChatroom.CreateBulk(builders...).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.WpChatroomUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (wccb *WpChatroomCreateBulk) OnConflict(opts ...sql.ConflictOption) *WpChatroomUpsertBulk {
+	wccb.conflict = opts
+	return &WpChatroomUpsertBulk{
+		create: wccb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.WpChatroom.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (wccb *WpChatroomCreateBulk) OnConflictColumns(columns ...string) *WpChatroomUpsertBulk {
+	wccb.conflict = append(wccb.conflict, sql.ConflictColumns(columns...))
+	return &WpChatroomUpsertBulk{
+		create: wccb,
+	}
+}
+
+// WpChatroomUpsertBulk is the builder for "upsert"-ing
+// a bulk of WpChatroom nodes.
+type WpChatroomUpsertBulk struct {
+	create *WpChatroomCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.WpChatroom.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(wpchatroom.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *WpChatroomUpsertBulk) UpdateNewValues() *WpChatroomUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		for _, b := range u.create.builders {
+			if _, exists := b.mutation.ID(); exists {
+				s.SetIgnore(wpchatroom.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(wpchatroom.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.WpChatroom.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *WpChatroomUpsertBulk) Ignore() *WpChatroomUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *WpChatroomUpsertBulk) DoNothing() *WpChatroomUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the WpChatroomCreateBulk.OnConflict
+// documentation for more info.
+func (u *WpChatroomUpsertBulk) Update(set func(*WpChatroomUpsert)) *WpChatroomUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&WpChatroomUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *WpChatroomUpsertBulk) SetUpdatedAt(v time.Time) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateUpdatedAt() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *WpChatroomUpsertBulk) SetStatus(v uint8) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *WpChatroomUpsertBulk) AddStatus(v uint8) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateStatus() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *WpChatroomUpsertBulk) ClearStatus() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (u *WpChatroomUpsertBulk) SetWxWxid(v string) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetWxWxid(v)
+	})
+}
+
+// UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateWxWxid() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateWxWxid()
+	})
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (u *WpChatroomUpsertBulk) SetChatroomID(v string) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetChatroomID(v)
+	})
+}
+
+// UpdateChatroomID sets the "chatroom_id" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateChatroomID() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateChatroomID()
+	})
+}
+
+// SetNickname sets the "nickname" field.
+func (u *WpChatroomUpsertBulk) SetNickname(v string) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetNickname(v)
+	})
+}
+
+// UpdateNickname sets the "nickname" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateNickname() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateNickname()
+	})
+}
+
+// SetOwner sets the "owner" field.
+func (u *WpChatroomUpsertBulk) SetOwner(v string) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetOwner(v)
+	})
+}
+
+// UpdateOwner sets the "owner" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateOwner() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateOwner()
+	})
+}
+
+// SetAvatar sets the "avatar" field.
+func (u *WpChatroomUpsertBulk) SetAvatar(v string) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetAvatar(v)
+	})
+}
+
+// UpdateAvatar sets the "avatar" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateAvatar() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateAvatar()
+	})
+}
+
+// SetMemberList sets the "member_list" field.
+func (u *WpChatroomUpsertBulk) SetMemberList(v []string) *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.SetMemberList(v)
+	})
+}
+
+// UpdateMemberList sets the "member_list" field to the value that was provided on create.
+func (u *WpChatroomUpsertBulk) UpdateMemberList() *WpChatroomUpsertBulk {
+	return u.Update(func(s *WpChatroomUpsert) {
+		s.UpdateMemberList()
+	})
+}
+
+// Exec executes the query.
+func (u *WpChatroomUpsertBulk) Exec(ctx context.Context) error {
+	if u.create.err != nil {
+		return u.create.err
+	}
+	for i, b := range u.create.builders {
+		if len(b.conflict) != 0 {
+			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the WpChatroomCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for WpChatroomCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *WpChatroomUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/wpchatroom_delete.go

@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/wpchatroom"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomDelete is the builder for deleting a WpChatroom entity.
+type WpChatroomDelete struct {
+	config
+	hooks    []Hook
+	mutation *WpChatroomMutation
+}
+
+// Where appends a list predicates to the WpChatroomDelete builder.
+func (wcd *WpChatroomDelete) Where(ps ...predicate.WpChatroom) *WpChatroomDelete {
+	wcd.mutation.Where(ps...)
+	return wcd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (wcd *WpChatroomDelete) Exec(ctx context.Context) (int, error) {
+	return withHooks(ctx, wcd.sqlExec, wcd.mutation, wcd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcd *WpChatroomDelete) ExecX(ctx context.Context) int {
+	n, err := wcd.Exec(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return n
+}
+
+func (wcd *WpChatroomDelete) sqlExec(ctx context.Context) (int, error) {
+	_spec := sqlgraph.NewDeleteSpec(wpchatroom.Table, sqlgraph.NewFieldSpec(wpchatroom.FieldID, field.TypeUint64))
+	if ps := wcd.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	affected, err := sqlgraph.DeleteNodes(ctx, wcd.driver, _spec)
+	if err != nil && sqlgraph.IsConstraintError(err) {
+		err = &ConstraintError{msg: err.Error(), wrap: err}
+	}
+	wcd.mutation.done = true
+	return affected, err
+}
+
+// WpChatroomDeleteOne is the builder for deleting a single WpChatroom entity.
+type WpChatroomDeleteOne struct {
+	wcd *WpChatroomDelete
+}
+
+// Where appends a list predicates to the WpChatroomDelete builder.
+func (wcdo *WpChatroomDeleteOne) Where(ps ...predicate.WpChatroom) *WpChatroomDeleteOne {
+	wcdo.wcd.mutation.Where(ps...)
+	return wcdo
+}
+
+// Exec executes the deletion query.
+func (wcdo *WpChatroomDeleteOne) Exec(ctx context.Context) error {
+	n, err := wcdo.wcd.Exec(ctx)
+	switch {
+	case err != nil:
+		return err
+	case n == 0:
+		return &NotFoundError{wpchatroom.Label}
+	default:
+		return nil
+	}
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcdo *WpChatroomDeleteOne) ExecX(ctx context.Context) {
+	if err := wcdo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 526 - 0
ent/wpchatroom_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/wpchatroom"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomQuery is the builder for querying WpChatroom entities.
+type WpChatroomQuery struct {
+	config
+	ctx        *QueryContext
+	order      []wpchatroom.OrderOption
+	inters     []Interceptor
+	predicates []predicate.WpChatroom
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the WpChatroomQuery builder.
+func (wcq *WpChatroomQuery) Where(ps ...predicate.WpChatroom) *WpChatroomQuery {
+	wcq.predicates = append(wcq.predicates, ps...)
+	return wcq
+}
+
+// Limit the number of records to be returned by this query.
+func (wcq *WpChatroomQuery) Limit(limit int) *WpChatroomQuery {
+	wcq.ctx.Limit = &limit
+	return wcq
+}
+
+// Offset to start from.
+func (wcq *WpChatroomQuery) Offset(offset int) *WpChatroomQuery {
+	wcq.ctx.Offset = &offset
+	return wcq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (wcq *WpChatroomQuery) Unique(unique bool) *WpChatroomQuery {
+	wcq.ctx.Unique = &unique
+	return wcq
+}
+
+// Order specifies how the records should be ordered.
+func (wcq *WpChatroomQuery) Order(o ...wpchatroom.OrderOption) *WpChatroomQuery {
+	wcq.order = append(wcq.order, o...)
+	return wcq
+}
+
+// First returns the first WpChatroom entity from the query.
+// Returns a *NotFoundError when no WpChatroom was found.
+func (wcq *WpChatroomQuery) First(ctx context.Context) (*WpChatroom, error) {
+	nodes, err := wcq.Limit(1).All(setContextOp(ctx, wcq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{wpchatroom.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (wcq *WpChatroomQuery) FirstX(ctx context.Context) *WpChatroom {
+	node, err := wcq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first WpChatroom ID from the query.
+// Returns a *NotFoundError when no WpChatroom ID was found.
+func (wcq *WpChatroomQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = wcq.Limit(1).IDs(setContextOp(ctx, wcq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{wpchatroom.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (wcq *WpChatroomQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := wcq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single WpChatroom entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one WpChatroom entity is found.
+// Returns a *NotFoundError when no WpChatroom entities are found.
+func (wcq *WpChatroomQuery) Only(ctx context.Context) (*WpChatroom, error) {
+	nodes, err := wcq.Limit(2).All(setContextOp(ctx, wcq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{wpchatroom.Label}
+	default:
+		return nil, &NotSingularError{wpchatroom.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (wcq *WpChatroomQuery) OnlyX(ctx context.Context) *WpChatroom {
+	node, err := wcq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only WpChatroom ID in the query.
+// Returns a *NotSingularError when more than one WpChatroom ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (wcq *WpChatroomQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = wcq.Limit(2).IDs(setContextOp(ctx, wcq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{wpchatroom.Label}
+	default:
+		err = &NotSingularError{wpchatroom.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (wcq *WpChatroomQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := wcq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of WpChatrooms.
+func (wcq *WpChatroomQuery) All(ctx context.Context) ([]*WpChatroom, error) {
+	ctx = setContextOp(ctx, wcq.ctx, "All")
+	if err := wcq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*WpChatroom, *WpChatroomQuery]()
+	return withInterceptors[[]*WpChatroom](ctx, wcq, qr, wcq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (wcq *WpChatroomQuery) AllX(ctx context.Context) []*WpChatroom {
+	nodes, err := wcq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of WpChatroom IDs.
+func (wcq *WpChatroomQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if wcq.ctx.Unique == nil && wcq.path != nil {
+		wcq.Unique(true)
+	}
+	ctx = setContextOp(ctx, wcq.ctx, "IDs")
+	if err = wcq.Select(wpchatroom.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (wcq *WpChatroomQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := wcq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (wcq *WpChatroomQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, wcq.ctx, "Count")
+	if err := wcq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, wcq, querierCount[*WpChatroomQuery](), wcq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (wcq *WpChatroomQuery) CountX(ctx context.Context) int {
+	count, err := wcq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (wcq *WpChatroomQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, wcq.ctx, "Exist")
+	switch _, err := wcq.FirstID(ctx); {
+	case IsNotFound(err):
+		return false, nil
+	case err != nil:
+		return false, fmt.Errorf("ent: check existence: %w", err)
+	default:
+		return true, nil
+	}
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (wcq *WpChatroomQuery) ExistX(ctx context.Context) bool {
+	exist, err := wcq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the WpChatroomQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (wcq *WpChatroomQuery) Clone() *WpChatroomQuery {
+	if wcq == nil {
+		return nil
+	}
+	return &WpChatroomQuery{
+		config:     wcq.config,
+		ctx:        wcq.ctx.Clone(),
+		order:      append([]wpchatroom.OrderOption{}, wcq.order...),
+		inters:     append([]Interceptor{}, wcq.inters...),
+		predicates: append([]predicate.WpChatroom{}, wcq.predicates...),
+		// clone intermediate query.
+		sql:  wcq.sql.Clone(),
+		path: wcq.path,
+	}
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//		Count int `json:"count,omitempty"`
+//	}
+//
+//	client.WpChatroom.Query().
+//		GroupBy(wpchatroom.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (wcq *WpChatroomQuery) GroupBy(field string, fields ...string) *WpChatroomGroupBy {
+	wcq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &WpChatroomGroupBy{build: wcq}
+	grbuild.flds = &wcq.ctx.Fields
+	grbuild.label = wpchatroom.Label
+	grbuild.scan = grbuild.Scan
+	return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//	}
+//
+//	client.WpChatroom.Query().
+//		Select(wpchatroom.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (wcq *WpChatroomQuery) Select(fields ...string) *WpChatroomSelect {
+	wcq.ctx.Fields = append(wcq.ctx.Fields, fields...)
+	sbuild := &WpChatroomSelect{WpChatroomQuery: wcq}
+	sbuild.label = wpchatroom.Label
+	sbuild.flds, sbuild.scan = &wcq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a WpChatroomSelect configured with the given aggregations.
+func (wcq *WpChatroomQuery) Aggregate(fns ...AggregateFunc) *WpChatroomSelect {
+	return wcq.Select().Aggregate(fns...)
+}
+
+func (wcq *WpChatroomQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range wcq.inters {
+		if inter == nil {
+			return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+		}
+		if trv, ok := inter.(Traverser); ok {
+			if err := trv.Traverse(ctx, wcq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range wcq.ctx.Fields {
+		if !wpchatroom.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if wcq.path != nil {
+		prev, err := wcq.path(ctx)
+		if err != nil {
+			return err
+		}
+		wcq.sql = prev
+	}
+	return nil
+}
+
+func (wcq *WpChatroomQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*WpChatroom, error) {
+	var (
+		nodes = []*WpChatroom{}
+		_spec = wcq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*WpChatroom).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &WpChatroom{config: wcq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, wcq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (wcq *WpChatroomQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := wcq.querySpec()
+	_spec.Node.Columns = wcq.ctx.Fields
+	if len(wcq.ctx.Fields) > 0 {
+		_spec.Unique = wcq.ctx.Unique != nil && *wcq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, wcq.driver, _spec)
+}
+
+func (wcq *WpChatroomQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(wpchatroom.Table, wpchatroom.Columns, sqlgraph.NewFieldSpec(wpchatroom.FieldID, field.TypeUint64))
+	_spec.From = wcq.sql
+	if unique := wcq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if wcq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := wcq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, wpchatroom.FieldID)
+		for i := range fields {
+			if fields[i] != wpchatroom.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := wcq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := wcq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := wcq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := wcq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (wcq *WpChatroomQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(wcq.driver.Dialect())
+	t1 := builder.Table(wpchatroom.Table)
+	columns := wcq.ctx.Fields
+	if len(columns) == 0 {
+		columns = wpchatroom.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if wcq.sql != nil {
+		selector = wcq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if wcq.ctx.Unique != nil && *wcq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range wcq.predicates {
+		p(selector)
+	}
+	for _, p := range wcq.order {
+		p(selector)
+	}
+	if offset := wcq.ctx.Offset; offset != nil {
+		// limit is mandatory for offset clause. We start
+		// with default value, and override it below if needed.
+		selector.Offset(*offset).Limit(math.MaxInt32)
+	}
+	if limit := wcq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// WpChatroomGroupBy is the group-by builder for WpChatroom entities.
+type WpChatroomGroupBy struct {
+	selector
+	build *WpChatroomQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (wcgb *WpChatroomGroupBy) Aggregate(fns ...AggregateFunc) *WpChatroomGroupBy {
+	wcgb.fns = append(wcgb.fns, fns...)
+	return wcgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (wcgb *WpChatroomGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, wcgb.build.ctx, "GroupBy")
+	if err := wcgb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*WpChatroomQuery, *WpChatroomGroupBy](ctx, wcgb.build, wcgb, wcgb.build.inters, v)
+}
+
+func (wcgb *WpChatroomGroupBy) sqlScan(ctx context.Context, root *WpChatroomQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(wcgb.fns))
+	for _, fn := range wcgb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*wcgb.flds)+len(wcgb.fns))
+		for _, f := range *wcgb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*wcgb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := wcgb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// WpChatroomSelect is the builder for selecting fields of WpChatroom entities.
+type WpChatroomSelect struct {
+	*WpChatroomQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (wcs *WpChatroomSelect) Aggregate(fns ...AggregateFunc) *WpChatroomSelect {
+	wcs.fns = append(wcs.fns, fns...)
+	return wcs
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (wcs *WpChatroomSelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, wcs.ctx, "Select")
+	if err := wcs.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*WpChatroomQuery, *WpChatroomSelect](ctx, wcs.WpChatroomQuery, wcs, wcs.inters, v)
+}
+
+func (wcs *WpChatroomSelect) sqlScan(ctx context.Context, root *WpChatroomQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(wcs.fns))
+	for _, fn := range wcs.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*wcs.selector.flds); {
+	case n == 0 && len(aggregation) > 0:
+		selector.Select(aggregation...)
+	case n != 0 && len(aggregation) > 0:
+		selector.AppendSelect(aggregation...)
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := wcs.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 495 - 0
ent/wpchatroom_update.go

@@ -0,0 +1,495 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/wpchatroom"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/dialect/sql/sqljson"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomUpdate is the builder for updating WpChatroom entities.
+type WpChatroomUpdate struct {
+	config
+	hooks    []Hook
+	mutation *WpChatroomMutation
+}
+
+// Where appends a list predicates to the WpChatroomUpdate builder.
+func (wcu *WpChatroomUpdate) Where(ps ...predicate.WpChatroom) *WpChatroomUpdate {
+	wcu.mutation.Where(ps...)
+	return wcu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (wcu *WpChatroomUpdate) SetUpdatedAt(t time.Time) *WpChatroomUpdate {
+	wcu.mutation.SetUpdatedAt(t)
+	return wcu
+}
+
+// SetStatus sets the "status" field.
+func (wcu *WpChatroomUpdate) SetStatus(u uint8) *WpChatroomUpdate {
+	wcu.mutation.ResetStatus()
+	wcu.mutation.SetStatus(u)
+	return wcu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (wcu *WpChatroomUpdate) SetNillableStatus(u *uint8) *WpChatroomUpdate {
+	if u != nil {
+		wcu.SetStatus(*u)
+	}
+	return wcu
+}
+
+// AddStatus adds u to the "status" field.
+func (wcu *WpChatroomUpdate) AddStatus(u int8) *WpChatroomUpdate {
+	wcu.mutation.AddStatus(u)
+	return wcu
+}
+
+// ClearStatus clears the value of the "status" field.
+func (wcu *WpChatroomUpdate) ClearStatus() *WpChatroomUpdate {
+	wcu.mutation.ClearStatus()
+	return wcu
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (wcu *WpChatroomUpdate) SetWxWxid(s string) *WpChatroomUpdate {
+	wcu.mutation.SetWxWxid(s)
+	return wcu
+}
+
+// SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
+func (wcu *WpChatroomUpdate) SetNillableWxWxid(s *string) *WpChatroomUpdate {
+	if s != nil {
+		wcu.SetWxWxid(*s)
+	}
+	return wcu
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (wcu *WpChatroomUpdate) SetChatroomID(s string) *WpChatroomUpdate {
+	wcu.mutation.SetChatroomID(s)
+	return wcu
+}
+
+// SetNillableChatroomID sets the "chatroom_id" field if the given value is not nil.
+func (wcu *WpChatroomUpdate) SetNillableChatroomID(s *string) *WpChatroomUpdate {
+	if s != nil {
+		wcu.SetChatroomID(*s)
+	}
+	return wcu
+}
+
+// SetNickname sets the "nickname" field.
+func (wcu *WpChatroomUpdate) SetNickname(s string) *WpChatroomUpdate {
+	wcu.mutation.SetNickname(s)
+	return wcu
+}
+
+// SetNillableNickname sets the "nickname" field if the given value is not nil.
+func (wcu *WpChatroomUpdate) SetNillableNickname(s *string) *WpChatroomUpdate {
+	if s != nil {
+		wcu.SetNickname(*s)
+	}
+	return wcu
+}
+
+// SetOwner sets the "owner" field.
+func (wcu *WpChatroomUpdate) SetOwner(s string) *WpChatroomUpdate {
+	wcu.mutation.SetOwner(s)
+	return wcu
+}
+
+// SetNillableOwner sets the "owner" field if the given value is not nil.
+func (wcu *WpChatroomUpdate) SetNillableOwner(s *string) *WpChatroomUpdate {
+	if s != nil {
+		wcu.SetOwner(*s)
+	}
+	return wcu
+}
+
+// SetAvatar sets the "avatar" field.
+func (wcu *WpChatroomUpdate) SetAvatar(s string) *WpChatroomUpdate {
+	wcu.mutation.SetAvatar(s)
+	return wcu
+}
+
+// SetNillableAvatar sets the "avatar" field if the given value is not nil.
+func (wcu *WpChatroomUpdate) SetNillableAvatar(s *string) *WpChatroomUpdate {
+	if s != nil {
+		wcu.SetAvatar(*s)
+	}
+	return wcu
+}
+
+// SetMemberList sets the "member_list" field.
+func (wcu *WpChatroomUpdate) SetMemberList(s []string) *WpChatroomUpdate {
+	wcu.mutation.SetMemberList(s)
+	return wcu
+}
+
+// AppendMemberList appends s to the "member_list" field.
+func (wcu *WpChatroomUpdate) AppendMemberList(s []string) *WpChatroomUpdate {
+	wcu.mutation.AppendMemberList(s)
+	return wcu
+}
+
+// Mutation returns the WpChatroomMutation object of the builder.
+func (wcu *WpChatroomUpdate) Mutation() *WpChatroomMutation {
+	return wcu.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (wcu *WpChatroomUpdate) Save(ctx context.Context) (int, error) {
+	wcu.defaults()
+	return withHooks(ctx, wcu.sqlSave, wcu.mutation, wcu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (wcu *WpChatroomUpdate) SaveX(ctx context.Context) int {
+	affected, err := wcu.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (wcu *WpChatroomUpdate) Exec(ctx context.Context) error {
+	_, err := wcu.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcu *WpChatroomUpdate) ExecX(ctx context.Context) {
+	if err := wcu.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (wcu *WpChatroomUpdate) defaults() {
+	if _, ok := wcu.mutation.UpdatedAt(); !ok {
+		v := wpchatroom.UpdateDefaultUpdatedAt()
+		wcu.mutation.SetUpdatedAt(v)
+	}
+}
+
+func (wcu *WpChatroomUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(wpchatroom.Table, wpchatroom.Columns, sqlgraph.NewFieldSpec(wpchatroom.FieldID, field.TypeUint64))
+	if ps := wcu.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := wcu.mutation.UpdatedAt(); ok {
+		_spec.SetField(wpchatroom.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := wcu.mutation.Status(); ok {
+		_spec.SetField(wpchatroom.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := wcu.mutation.AddedStatus(); ok {
+		_spec.AddField(wpchatroom.FieldStatus, field.TypeUint8, value)
+	}
+	if wcu.mutation.StatusCleared() {
+		_spec.ClearField(wpchatroom.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := wcu.mutation.WxWxid(); ok {
+		_spec.SetField(wpchatroom.FieldWxWxid, field.TypeString, value)
+	}
+	if value, ok := wcu.mutation.ChatroomID(); ok {
+		_spec.SetField(wpchatroom.FieldChatroomID, field.TypeString, value)
+	}
+	if value, ok := wcu.mutation.Nickname(); ok {
+		_spec.SetField(wpchatroom.FieldNickname, field.TypeString, value)
+	}
+	if value, ok := wcu.mutation.Owner(); ok {
+		_spec.SetField(wpchatroom.FieldOwner, field.TypeString, value)
+	}
+	if value, ok := wcu.mutation.Avatar(); ok {
+		_spec.SetField(wpchatroom.FieldAvatar, field.TypeString, value)
+	}
+	if value, ok := wcu.mutation.MemberList(); ok {
+		_spec.SetField(wpchatroom.FieldMemberList, field.TypeJSON, value)
+	}
+	if value, ok := wcu.mutation.AppendedMemberList(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, wpchatroom.FieldMemberList, value)
+		})
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, wcu.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{wpchatroom.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	wcu.mutation.done = true
+	return n, nil
+}
+
+// WpChatroomUpdateOne is the builder for updating a single WpChatroom entity.
+type WpChatroomUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *WpChatroomMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (wcuo *WpChatroomUpdateOne) SetUpdatedAt(t time.Time) *WpChatroomUpdateOne {
+	wcuo.mutation.SetUpdatedAt(t)
+	return wcuo
+}
+
+// SetStatus sets the "status" field.
+func (wcuo *WpChatroomUpdateOne) SetStatus(u uint8) *WpChatroomUpdateOne {
+	wcuo.mutation.ResetStatus()
+	wcuo.mutation.SetStatus(u)
+	return wcuo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (wcuo *WpChatroomUpdateOne) SetNillableStatus(u *uint8) *WpChatroomUpdateOne {
+	if u != nil {
+		wcuo.SetStatus(*u)
+	}
+	return wcuo
+}
+
+// AddStatus adds u to the "status" field.
+func (wcuo *WpChatroomUpdateOne) AddStatus(u int8) *WpChatroomUpdateOne {
+	wcuo.mutation.AddStatus(u)
+	return wcuo
+}
+
+// ClearStatus clears the value of the "status" field.
+func (wcuo *WpChatroomUpdateOne) ClearStatus() *WpChatroomUpdateOne {
+	wcuo.mutation.ClearStatus()
+	return wcuo
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (wcuo *WpChatroomUpdateOne) SetWxWxid(s string) *WpChatroomUpdateOne {
+	wcuo.mutation.SetWxWxid(s)
+	return wcuo
+}
+
+// SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
+func (wcuo *WpChatroomUpdateOne) SetNillableWxWxid(s *string) *WpChatroomUpdateOne {
+	if s != nil {
+		wcuo.SetWxWxid(*s)
+	}
+	return wcuo
+}
+
+// SetChatroomID sets the "chatroom_id" field.
+func (wcuo *WpChatroomUpdateOne) SetChatroomID(s string) *WpChatroomUpdateOne {
+	wcuo.mutation.SetChatroomID(s)
+	return wcuo
+}
+
+// SetNillableChatroomID sets the "chatroom_id" field if the given value is not nil.
+func (wcuo *WpChatroomUpdateOne) SetNillableChatroomID(s *string) *WpChatroomUpdateOne {
+	if s != nil {
+		wcuo.SetChatroomID(*s)
+	}
+	return wcuo
+}
+
+// SetNickname sets the "nickname" field.
+func (wcuo *WpChatroomUpdateOne) SetNickname(s string) *WpChatroomUpdateOne {
+	wcuo.mutation.SetNickname(s)
+	return wcuo
+}
+
+// SetNillableNickname sets the "nickname" field if the given value is not nil.
+func (wcuo *WpChatroomUpdateOne) SetNillableNickname(s *string) *WpChatroomUpdateOne {
+	if s != nil {
+		wcuo.SetNickname(*s)
+	}
+	return wcuo
+}
+
+// SetOwner sets the "owner" field.
+func (wcuo *WpChatroomUpdateOne) SetOwner(s string) *WpChatroomUpdateOne {
+	wcuo.mutation.SetOwner(s)
+	return wcuo
+}
+
+// SetNillableOwner sets the "owner" field if the given value is not nil.
+func (wcuo *WpChatroomUpdateOne) SetNillableOwner(s *string) *WpChatroomUpdateOne {
+	if s != nil {
+		wcuo.SetOwner(*s)
+	}
+	return wcuo
+}
+
+// SetAvatar sets the "avatar" field.
+func (wcuo *WpChatroomUpdateOne) SetAvatar(s string) *WpChatroomUpdateOne {
+	wcuo.mutation.SetAvatar(s)
+	return wcuo
+}
+
+// SetNillableAvatar sets the "avatar" field if the given value is not nil.
+func (wcuo *WpChatroomUpdateOne) SetNillableAvatar(s *string) *WpChatroomUpdateOne {
+	if s != nil {
+		wcuo.SetAvatar(*s)
+	}
+	return wcuo
+}
+
+// SetMemberList sets the "member_list" field.
+func (wcuo *WpChatroomUpdateOne) SetMemberList(s []string) *WpChatroomUpdateOne {
+	wcuo.mutation.SetMemberList(s)
+	return wcuo
+}
+
+// AppendMemberList appends s to the "member_list" field.
+func (wcuo *WpChatroomUpdateOne) AppendMemberList(s []string) *WpChatroomUpdateOne {
+	wcuo.mutation.AppendMemberList(s)
+	return wcuo
+}
+
+// Mutation returns the WpChatroomMutation object of the builder.
+func (wcuo *WpChatroomUpdateOne) Mutation() *WpChatroomMutation {
+	return wcuo.mutation
+}
+
+// Where appends a list predicates to the WpChatroomUpdate builder.
+func (wcuo *WpChatroomUpdateOne) Where(ps ...predicate.WpChatroom) *WpChatroomUpdateOne {
+	wcuo.mutation.Where(ps...)
+	return wcuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (wcuo *WpChatroomUpdateOne) Select(field string, fields ...string) *WpChatroomUpdateOne {
+	wcuo.fields = append([]string{field}, fields...)
+	return wcuo
+}
+
+// Save executes the query and returns the updated WpChatroom entity.
+func (wcuo *WpChatroomUpdateOne) Save(ctx context.Context) (*WpChatroom, error) {
+	wcuo.defaults()
+	return withHooks(ctx, wcuo.sqlSave, wcuo.mutation, wcuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (wcuo *WpChatroomUpdateOne) SaveX(ctx context.Context) *WpChatroom {
+	node, err := wcuo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (wcuo *WpChatroomUpdateOne) Exec(ctx context.Context) error {
+	_, err := wcuo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcuo *WpChatroomUpdateOne) ExecX(ctx context.Context) {
+	if err := wcuo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (wcuo *WpChatroomUpdateOne) defaults() {
+	if _, ok := wcuo.mutation.UpdatedAt(); !ok {
+		v := wpchatroom.UpdateDefaultUpdatedAt()
+		wcuo.mutation.SetUpdatedAt(v)
+	}
+}
+
+func (wcuo *WpChatroomUpdateOne) sqlSave(ctx context.Context) (_node *WpChatroom, err error) {
+	_spec := sqlgraph.NewUpdateSpec(wpchatroom.Table, wpchatroom.Columns, sqlgraph.NewFieldSpec(wpchatroom.FieldID, field.TypeUint64))
+	id, ok := wcuo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "WpChatroom.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := wcuo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, wpchatroom.FieldID)
+		for _, f := range fields {
+			if !wpchatroom.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != wpchatroom.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := wcuo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := wcuo.mutation.UpdatedAt(); ok {
+		_spec.SetField(wpchatroom.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := wcuo.mutation.Status(); ok {
+		_spec.SetField(wpchatroom.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := wcuo.mutation.AddedStatus(); ok {
+		_spec.AddField(wpchatroom.FieldStatus, field.TypeUint8, value)
+	}
+	if wcuo.mutation.StatusCleared() {
+		_spec.ClearField(wpchatroom.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := wcuo.mutation.WxWxid(); ok {
+		_spec.SetField(wpchatroom.FieldWxWxid, field.TypeString, value)
+	}
+	if value, ok := wcuo.mutation.ChatroomID(); ok {
+		_spec.SetField(wpchatroom.FieldChatroomID, field.TypeString, value)
+	}
+	if value, ok := wcuo.mutation.Nickname(); ok {
+		_spec.SetField(wpchatroom.FieldNickname, field.TypeString, value)
+	}
+	if value, ok := wcuo.mutation.Owner(); ok {
+		_spec.SetField(wpchatroom.FieldOwner, field.TypeString, value)
+	}
+	if value, ok := wcuo.mutation.Avatar(); ok {
+		_spec.SetField(wpchatroom.FieldAvatar, field.TypeString, value)
+	}
+	if value, ok := wcuo.mutation.MemberList(); ok {
+		_spec.SetField(wpchatroom.FieldMemberList, field.TypeJSON, value)
+	}
+	if value, ok := wcuo.mutation.AppendedMemberList(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, wpchatroom.FieldMemberList, value)
+		})
+	}
+	_node = &WpChatroom{config: wcuo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, wcuo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{wpchatroom.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	wcuo.mutation.done = true
+	return _node, nil
+}

+ 172 - 0
ent/wpchatroommember.go

@@ -0,0 +1,172 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/wpchatroommember"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// WpChatroomMember is the model entity for the WpChatroomMember schema.
+type WpChatroomMember struct {
+	config `json:"-"`
+	// ID of the ent.
+	ID uint64 `json:"id,omitempty"`
+	// Create Time | 创建日期
+	CreatedAt time.Time `json:"created_at,omitempty"`
+	// Update Time | 修改日期
+	UpdatedAt time.Time `json:"updated_at,omitempty"`
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status uint8 `json:"status,omitempty"`
+	// 所属微信id
+	WxWxid string `json:"wx_wxid,omitempty"`
+	// 微信id
+	Wxid string `json:"wxid,omitempty"`
+	// 群昵称
+	Nickname string `json:"nickname,omitempty"`
+	// 群头像
+	Avatar       string `json:"avatar,omitempty"`
+	selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*WpChatroomMember) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case wpchatroommember.FieldID, wpchatroommember.FieldStatus:
+			values[i] = new(sql.NullInt64)
+		case wpchatroommember.FieldWxWxid, wpchatroommember.FieldWxid, wpchatroommember.FieldNickname, wpchatroommember.FieldAvatar:
+			values[i] = new(sql.NullString)
+		case wpchatroommember.FieldCreatedAt, wpchatroommember.FieldUpdatedAt:
+			values[i] = new(sql.NullTime)
+		default:
+			values[i] = new(sql.UnknownType)
+		}
+	}
+	return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the WpChatroomMember fields.
+func (wcm *WpChatroomMember) assignValues(columns []string, values []any) error {
+	if m, n := len(values), len(columns); m < n {
+		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+	}
+	for i := range columns {
+		switch columns[i] {
+		case wpchatroommember.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			wcm.ID = uint64(value.Int64)
+		case wpchatroommember.FieldCreatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field created_at", values[i])
+			} else if value.Valid {
+				wcm.CreatedAt = value.Time
+			}
+		case wpchatroommember.FieldUpdatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+			} else if value.Valid {
+				wcm.UpdatedAt = value.Time
+			}
+		case wpchatroommember.FieldStatus:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field status", values[i])
+			} else if value.Valid {
+				wcm.Status = uint8(value.Int64)
+			}
+		case wpchatroommember.FieldWxWxid:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field wx_wxid", values[i])
+			} else if value.Valid {
+				wcm.WxWxid = value.String
+			}
+		case wpchatroommember.FieldWxid:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field wxid", values[i])
+			} else if value.Valid {
+				wcm.Wxid = value.String
+			}
+		case wpchatroommember.FieldNickname:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field nickname", values[i])
+			} else if value.Valid {
+				wcm.Nickname = value.String
+			}
+		case wpchatroommember.FieldAvatar:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field avatar", values[i])
+			} else if value.Valid {
+				wcm.Avatar = value.String
+			}
+		default:
+			wcm.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the WpChatroomMember.
+// This includes values selected through modifiers, order, etc.
+func (wcm *WpChatroomMember) Value(name string) (ent.Value, error) {
+	return wcm.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this WpChatroomMember.
+// Note that you need to call WpChatroomMember.Unwrap() before calling this method if this WpChatroomMember
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (wcm *WpChatroomMember) Update() *WpChatroomMemberUpdateOne {
+	return NewWpChatroomMemberClient(wcm.config).UpdateOne(wcm)
+}
+
+// Unwrap unwraps the WpChatroomMember entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (wcm *WpChatroomMember) Unwrap() *WpChatroomMember {
+	_tx, ok := wcm.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: WpChatroomMember is not a transactional entity")
+	}
+	wcm.config.driver = _tx.drv
+	return wcm
+}
+
+// String implements the fmt.Stringer.
+func (wcm *WpChatroomMember) String() string {
+	var builder strings.Builder
+	builder.WriteString("WpChatroomMember(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", wcm.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(wcm.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(wcm.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("status=")
+	builder.WriteString(fmt.Sprintf("%v", wcm.Status))
+	builder.WriteString(", ")
+	builder.WriteString("wx_wxid=")
+	builder.WriteString(wcm.WxWxid)
+	builder.WriteString(", ")
+	builder.WriteString("wxid=")
+	builder.WriteString(wcm.Wxid)
+	builder.WriteString(", ")
+	builder.WriteString("nickname=")
+	builder.WriteString(wcm.Nickname)
+	builder.WriteString(", ")
+	builder.WriteString("avatar=")
+	builder.WriteString(wcm.Avatar)
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// WpChatroomMembers is a parsable slice of WpChatroomMember.
+type WpChatroomMembers []*WpChatroomMember

+ 495 - 0
ent/wpchatroommember/where.go

@@ -0,0 +1,495 @@
+// Code generated by ent, DO NOT EDIT.
+
+package wpchatroommember
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldStatus, v))
+}
+
+// WxWxid applies equality check predicate on the "wx_wxid" field. It's identical to WxWxidEQ.
+func WxWxid(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldWxWxid, v))
+}
+
+// Wxid applies equality check predicate on the "wxid" field. It's identical to WxidEQ.
+func Wxid(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldWxid, v))
+}
+
+// Nickname applies equality check predicate on the "nickname" field. It's identical to NicknameEQ.
+func Nickname(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldNickname, v))
+}
+
+// Avatar applies equality check predicate on the "avatar" field. It's identical to AvatarEQ.
+func Avatar(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldAvatar, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v uint8) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusIsNil applies the IsNil predicate on the "status" field.
+func StatusIsNil() predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIsNull(FieldStatus))
+}
+
+// StatusNotNil applies the NotNil predicate on the "status" field.
+func StatusNotNil() predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotNull(FieldStatus))
+}
+
+// WxWxidEQ applies the EQ predicate on the "wx_wxid" field.
+func WxWxidEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldWxWxid, v))
+}
+
+// WxWxidNEQ applies the NEQ predicate on the "wx_wxid" field.
+func WxWxidNEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldWxWxid, v))
+}
+
+// WxWxidIn applies the In predicate on the "wx_wxid" field.
+func WxWxidIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldWxWxid, vs...))
+}
+
+// WxWxidNotIn applies the NotIn predicate on the "wx_wxid" field.
+func WxWxidNotIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldWxWxid, vs...))
+}
+
+// WxWxidGT applies the GT predicate on the "wx_wxid" field.
+func WxWxidGT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldWxWxid, v))
+}
+
+// WxWxidGTE applies the GTE predicate on the "wx_wxid" field.
+func WxWxidGTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldWxWxid, v))
+}
+
+// WxWxidLT applies the LT predicate on the "wx_wxid" field.
+func WxWxidLT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldWxWxid, v))
+}
+
+// WxWxidLTE applies the LTE predicate on the "wx_wxid" field.
+func WxWxidLTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldWxWxid, v))
+}
+
+// WxWxidContains applies the Contains predicate on the "wx_wxid" field.
+func WxWxidContains(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContains(FieldWxWxid, v))
+}
+
+// WxWxidHasPrefix applies the HasPrefix predicate on the "wx_wxid" field.
+func WxWxidHasPrefix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasPrefix(FieldWxWxid, v))
+}
+
+// WxWxidHasSuffix applies the HasSuffix predicate on the "wx_wxid" field.
+func WxWxidHasSuffix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasSuffix(FieldWxWxid, v))
+}
+
+// WxWxidEqualFold applies the EqualFold predicate on the "wx_wxid" field.
+func WxWxidEqualFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEqualFold(FieldWxWxid, v))
+}
+
+// WxWxidContainsFold applies the ContainsFold predicate on the "wx_wxid" field.
+func WxWxidContainsFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContainsFold(FieldWxWxid, v))
+}
+
+// WxidEQ applies the EQ predicate on the "wxid" field.
+func WxidEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldWxid, v))
+}
+
+// WxidNEQ applies the NEQ predicate on the "wxid" field.
+func WxidNEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldWxid, v))
+}
+
+// WxidIn applies the In predicate on the "wxid" field.
+func WxidIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldWxid, vs...))
+}
+
+// WxidNotIn applies the NotIn predicate on the "wxid" field.
+func WxidNotIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldWxid, vs...))
+}
+
+// WxidGT applies the GT predicate on the "wxid" field.
+func WxidGT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldWxid, v))
+}
+
+// WxidGTE applies the GTE predicate on the "wxid" field.
+func WxidGTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldWxid, v))
+}
+
+// WxidLT applies the LT predicate on the "wxid" field.
+func WxidLT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldWxid, v))
+}
+
+// WxidLTE applies the LTE predicate on the "wxid" field.
+func WxidLTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldWxid, v))
+}
+
+// WxidContains applies the Contains predicate on the "wxid" field.
+func WxidContains(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContains(FieldWxid, v))
+}
+
+// WxidHasPrefix applies the HasPrefix predicate on the "wxid" field.
+func WxidHasPrefix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasPrefix(FieldWxid, v))
+}
+
+// WxidHasSuffix applies the HasSuffix predicate on the "wxid" field.
+func WxidHasSuffix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasSuffix(FieldWxid, v))
+}
+
+// WxidEqualFold applies the EqualFold predicate on the "wxid" field.
+func WxidEqualFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEqualFold(FieldWxid, v))
+}
+
+// WxidContainsFold applies the ContainsFold predicate on the "wxid" field.
+func WxidContainsFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContainsFold(FieldWxid, v))
+}
+
+// NicknameEQ applies the EQ predicate on the "nickname" field.
+func NicknameEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldNickname, v))
+}
+
+// NicknameNEQ applies the NEQ predicate on the "nickname" field.
+func NicknameNEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldNickname, v))
+}
+
+// NicknameIn applies the In predicate on the "nickname" field.
+func NicknameIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldNickname, vs...))
+}
+
+// NicknameNotIn applies the NotIn predicate on the "nickname" field.
+func NicknameNotIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldNickname, vs...))
+}
+
+// NicknameGT applies the GT predicate on the "nickname" field.
+func NicknameGT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldNickname, v))
+}
+
+// NicknameGTE applies the GTE predicate on the "nickname" field.
+func NicknameGTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldNickname, v))
+}
+
+// NicknameLT applies the LT predicate on the "nickname" field.
+func NicknameLT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldNickname, v))
+}
+
+// NicknameLTE applies the LTE predicate on the "nickname" field.
+func NicknameLTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldNickname, v))
+}
+
+// NicknameContains applies the Contains predicate on the "nickname" field.
+func NicknameContains(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContains(FieldNickname, v))
+}
+
+// NicknameHasPrefix applies the HasPrefix predicate on the "nickname" field.
+func NicknameHasPrefix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasPrefix(FieldNickname, v))
+}
+
+// NicknameHasSuffix applies the HasSuffix predicate on the "nickname" field.
+func NicknameHasSuffix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasSuffix(FieldNickname, v))
+}
+
+// NicknameEqualFold applies the EqualFold predicate on the "nickname" field.
+func NicknameEqualFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEqualFold(FieldNickname, v))
+}
+
+// NicknameContainsFold applies the ContainsFold predicate on the "nickname" field.
+func NicknameContainsFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContainsFold(FieldNickname, v))
+}
+
+// AvatarEQ applies the EQ predicate on the "avatar" field.
+func AvatarEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEQ(FieldAvatar, v))
+}
+
+// AvatarNEQ applies the NEQ predicate on the "avatar" field.
+func AvatarNEQ(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNEQ(FieldAvatar, v))
+}
+
+// AvatarIn applies the In predicate on the "avatar" field.
+func AvatarIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldIn(FieldAvatar, vs...))
+}
+
+// AvatarNotIn applies the NotIn predicate on the "avatar" field.
+func AvatarNotIn(vs ...string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldNotIn(FieldAvatar, vs...))
+}
+
+// AvatarGT applies the GT predicate on the "avatar" field.
+func AvatarGT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGT(FieldAvatar, v))
+}
+
+// AvatarGTE applies the GTE predicate on the "avatar" field.
+func AvatarGTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldGTE(FieldAvatar, v))
+}
+
+// AvatarLT applies the LT predicate on the "avatar" field.
+func AvatarLT(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLT(FieldAvatar, v))
+}
+
+// AvatarLTE applies the LTE predicate on the "avatar" field.
+func AvatarLTE(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldLTE(FieldAvatar, v))
+}
+
+// AvatarContains applies the Contains predicate on the "avatar" field.
+func AvatarContains(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContains(FieldAvatar, v))
+}
+
+// AvatarHasPrefix applies the HasPrefix predicate on the "avatar" field.
+func AvatarHasPrefix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasPrefix(FieldAvatar, v))
+}
+
+// AvatarHasSuffix applies the HasSuffix predicate on the "avatar" field.
+func AvatarHasSuffix(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldHasSuffix(FieldAvatar, v))
+}
+
+// AvatarEqualFold applies the EqualFold predicate on the "avatar" field.
+func AvatarEqualFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldEqualFold(FieldAvatar, v))
+}
+
+// AvatarContainsFold applies the ContainsFold predicate on the "avatar" field.
+func AvatarContainsFold(v string) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.FieldContainsFold(FieldAvatar, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.WpChatroomMember) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.WpChatroomMember) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.WpChatroomMember) predicate.WpChatroomMember {
+	return predicate.WpChatroomMember(sql.NotPredicates(p))
+}

+ 116 - 0
ent/wpchatroommember/wpchatroommember.go

@@ -0,0 +1,116 @@
+// Code generated by ent, DO NOT EDIT.
+
+package wpchatroommember
+
+import (
+	"time"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the wpchatroommember type in the database.
+	Label = "wp_chatroom_member"
+	// FieldID holds the string denoting the id field in the database.
+	FieldID = "id"
+	// FieldCreatedAt holds the string denoting the created_at field in the database.
+	FieldCreatedAt = "created_at"
+	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
+	FieldUpdatedAt = "updated_at"
+	// FieldStatus holds the string denoting the status field in the database.
+	FieldStatus = "status"
+	// FieldWxWxid holds the string denoting the wx_wxid field in the database.
+	FieldWxWxid = "wx_wxid"
+	// FieldWxid holds the string denoting the wxid field in the database.
+	FieldWxid = "wxid"
+	// FieldNickname holds the string denoting the nickname field in the database.
+	FieldNickname = "nickname"
+	// FieldAvatar holds the string denoting the avatar field in the database.
+	FieldAvatar = "avatar"
+	// Table holds the table name of the wpchatroommember in the database.
+	Table = "wp_chatroom_member"
+)
+
+// Columns holds all SQL columns for wpchatroommember fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldStatus,
+	FieldWxWxid,
+	FieldWxid,
+	FieldNickname,
+	FieldAvatar,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+	for i := range Columns {
+		if column == Columns[i] {
+			return true
+		}
+	}
+	return false
+}
+
+var (
+	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
+	DefaultCreatedAt func() time.Time
+	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+	DefaultUpdatedAt func() time.Time
+	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+	UpdateDefaultUpdatedAt func() time.Time
+	// DefaultStatus holds the default value on creation for the "status" field.
+	DefaultStatus uint8
+	// DefaultWxWxid holds the default value on creation for the "wx_wxid" field.
+	DefaultWxWxid string
+	// DefaultWxid holds the default value on creation for the "wxid" field.
+	DefaultWxid string
+	// DefaultNickname holds the default value on creation for the "nickname" field.
+	DefaultNickname string
+	// DefaultAvatar holds the default value on creation for the "avatar" field.
+	DefaultAvatar string
+)
+
+// OrderOption defines the ordering options for the WpChatroomMember queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByWxWxid orders the results by the wx_wxid field.
+func ByWxWxid(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldWxWxid, opts...).ToFunc()
+}
+
+// ByWxid orders the results by the wxid field.
+func ByWxid(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldWxid, opts...).ToFunc()
+}
+
+// ByNickname orders the results by the nickname field.
+func ByNickname(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldNickname, opts...).ToFunc()
+}
+
+// ByAvatar orders the results by the avatar field.
+func ByAvatar(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldAvatar, opts...).ToFunc()
+}

+ 896 - 0
ent/wpchatroommember_create.go

@@ -0,0 +1,896 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/wpchatroommember"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomMemberCreate is the builder for creating a WpChatroomMember entity.
+type WpChatroomMemberCreate struct {
+	config
+	mutation *WpChatroomMemberMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (wcmc *WpChatroomMemberCreate) SetCreatedAt(t time.Time) *WpChatroomMemberCreate {
+	wcmc.mutation.SetCreatedAt(t)
+	return wcmc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableCreatedAt(t *time.Time) *WpChatroomMemberCreate {
+	if t != nil {
+		wcmc.SetCreatedAt(*t)
+	}
+	return wcmc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (wcmc *WpChatroomMemberCreate) SetUpdatedAt(t time.Time) *WpChatroomMemberCreate {
+	wcmc.mutation.SetUpdatedAt(t)
+	return wcmc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableUpdatedAt(t *time.Time) *WpChatroomMemberCreate {
+	if t != nil {
+		wcmc.SetUpdatedAt(*t)
+	}
+	return wcmc
+}
+
+// SetStatus sets the "status" field.
+func (wcmc *WpChatroomMemberCreate) SetStatus(u uint8) *WpChatroomMemberCreate {
+	wcmc.mutation.SetStatus(u)
+	return wcmc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableStatus(u *uint8) *WpChatroomMemberCreate {
+	if u != nil {
+		wcmc.SetStatus(*u)
+	}
+	return wcmc
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (wcmc *WpChatroomMemberCreate) SetWxWxid(s string) *WpChatroomMemberCreate {
+	wcmc.mutation.SetWxWxid(s)
+	return wcmc
+}
+
+// SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableWxWxid(s *string) *WpChatroomMemberCreate {
+	if s != nil {
+		wcmc.SetWxWxid(*s)
+	}
+	return wcmc
+}
+
+// SetWxid sets the "wxid" field.
+func (wcmc *WpChatroomMemberCreate) SetWxid(s string) *WpChatroomMemberCreate {
+	wcmc.mutation.SetWxid(s)
+	return wcmc
+}
+
+// SetNillableWxid sets the "wxid" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableWxid(s *string) *WpChatroomMemberCreate {
+	if s != nil {
+		wcmc.SetWxid(*s)
+	}
+	return wcmc
+}
+
+// SetNickname sets the "nickname" field.
+func (wcmc *WpChatroomMemberCreate) SetNickname(s string) *WpChatroomMemberCreate {
+	wcmc.mutation.SetNickname(s)
+	return wcmc
+}
+
+// SetNillableNickname sets the "nickname" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableNickname(s *string) *WpChatroomMemberCreate {
+	if s != nil {
+		wcmc.SetNickname(*s)
+	}
+	return wcmc
+}
+
+// SetAvatar sets the "avatar" field.
+func (wcmc *WpChatroomMemberCreate) SetAvatar(s string) *WpChatroomMemberCreate {
+	wcmc.mutation.SetAvatar(s)
+	return wcmc
+}
+
+// SetNillableAvatar sets the "avatar" field if the given value is not nil.
+func (wcmc *WpChatroomMemberCreate) SetNillableAvatar(s *string) *WpChatroomMemberCreate {
+	if s != nil {
+		wcmc.SetAvatar(*s)
+	}
+	return wcmc
+}
+
+// SetID sets the "id" field.
+func (wcmc *WpChatroomMemberCreate) SetID(u uint64) *WpChatroomMemberCreate {
+	wcmc.mutation.SetID(u)
+	return wcmc
+}
+
+// Mutation returns the WpChatroomMemberMutation object of the builder.
+func (wcmc *WpChatroomMemberCreate) Mutation() *WpChatroomMemberMutation {
+	return wcmc.mutation
+}
+
+// Save creates the WpChatroomMember in the database.
+func (wcmc *WpChatroomMemberCreate) Save(ctx context.Context) (*WpChatroomMember, error) {
+	wcmc.defaults()
+	return withHooks(ctx, wcmc.sqlSave, wcmc.mutation, wcmc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (wcmc *WpChatroomMemberCreate) SaveX(ctx context.Context) *WpChatroomMember {
+	v, err := wcmc.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (wcmc *WpChatroomMemberCreate) Exec(ctx context.Context) error {
+	_, err := wcmc.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcmc *WpChatroomMemberCreate) ExecX(ctx context.Context) {
+	if err := wcmc.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (wcmc *WpChatroomMemberCreate) defaults() {
+	if _, ok := wcmc.mutation.CreatedAt(); !ok {
+		v := wpchatroommember.DefaultCreatedAt()
+		wcmc.mutation.SetCreatedAt(v)
+	}
+	if _, ok := wcmc.mutation.UpdatedAt(); !ok {
+		v := wpchatroommember.DefaultUpdatedAt()
+		wcmc.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := wcmc.mutation.Status(); !ok {
+		v := wpchatroommember.DefaultStatus
+		wcmc.mutation.SetStatus(v)
+	}
+	if _, ok := wcmc.mutation.WxWxid(); !ok {
+		v := wpchatroommember.DefaultWxWxid
+		wcmc.mutation.SetWxWxid(v)
+	}
+	if _, ok := wcmc.mutation.Wxid(); !ok {
+		v := wpchatroommember.DefaultWxid
+		wcmc.mutation.SetWxid(v)
+	}
+	if _, ok := wcmc.mutation.Nickname(); !ok {
+		v := wpchatroommember.DefaultNickname
+		wcmc.mutation.SetNickname(v)
+	}
+	if _, ok := wcmc.mutation.Avatar(); !ok {
+		v := wpchatroommember.DefaultAvatar
+		wcmc.mutation.SetAvatar(v)
+	}
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (wcmc *WpChatroomMemberCreate) check() error {
+	if _, ok := wcmc.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "WpChatroomMember.created_at"`)}
+	}
+	if _, ok := wcmc.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "WpChatroomMember.updated_at"`)}
+	}
+	if _, ok := wcmc.mutation.WxWxid(); !ok {
+		return &ValidationError{Name: "wx_wxid", err: errors.New(`ent: missing required field "WpChatroomMember.wx_wxid"`)}
+	}
+	if _, ok := wcmc.mutation.Wxid(); !ok {
+		return &ValidationError{Name: "wxid", err: errors.New(`ent: missing required field "WpChatroomMember.wxid"`)}
+	}
+	if _, ok := wcmc.mutation.Nickname(); !ok {
+		return &ValidationError{Name: "nickname", err: errors.New(`ent: missing required field "WpChatroomMember.nickname"`)}
+	}
+	if _, ok := wcmc.mutation.Avatar(); !ok {
+		return &ValidationError{Name: "avatar", err: errors.New(`ent: missing required field "WpChatroomMember.avatar"`)}
+	}
+	return nil
+}
+
+func (wcmc *WpChatroomMemberCreate) sqlSave(ctx context.Context) (*WpChatroomMember, error) {
+	if err := wcmc.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := wcmc.createSpec()
+	if err := sqlgraph.CreateNode(ctx, wcmc.driver, _spec); err != nil {
+		if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	if _spec.ID.Value != _node.ID {
+		id := _spec.ID.Value.(int64)
+		_node.ID = uint64(id)
+	}
+	wcmc.mutation.id = &_node.ID
+	wcmc.mutation.done = true
+	return _node, nil
+}
+
+func (wcmc *WpChatroomMemberCreate) createSpec() (*WpChatroomMember, *sqlgraph.CreateSpec) {
+	var (
+		_node = &WpChatroomMember{config: wcmc.config}
+		_spec = sqlgraph.NewCreateSpec(wpchatroommember.Table, sqlgraph.NewFieldSpec(wpchatroommember.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = wcmc.conflict
+	if id, ok := wcmc.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := wcmc.mutation.CreatedAt(); ok {
+		_spec.SetField(wpchatroommember.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := wcmc.mutation.UpdatedAt(); ok {
+		_spec.SetField(wpchatroommember.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := wcmc.mutation.Status(); ok {
+		_spec.SetField(wpchatroommember.FieldStatus, field.TypeUint8, value)
+		_node.Status = value
+	}
+	if value, ok := wcmc.mutation.WxWxid(); ok {
+		_spec.SetField(wpchatroommember.FieldWxWxid, field.TypeString, value)
+		_node.WxWxid = value
+	}
+	if value, ok := wcmc.mutation.Wxid(); ok {
+		_spec.SetField(wpchatroommember.FieldWxid, field.TypeString, value)
+		_node.Wxid = value
+	}
+	if value, ok := wcmc.mutation.Nickname(); ok {
+		_spec.SetField(wpchatroommember.FieldNickname, field.TypeString, value)
+		_node.Nickname = value
+	}
+	if value, ok := wcmc.mutation.Avatar(); ok {
+		_spec.SetField(wpchatroommember.FieldAvatar, field.TypeString, value)
+		_node.Avatar = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.WpChatroomMember.Create().
+//		SetCreatedAt(v).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.WpChatroomMemberUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (wcmc *WpChatroomMemberCreate) OnConflict(opts ...sql.ConflictOption) *WpChatroomMemberUpsertOne {
+	wcmc.conflict = opts
+	return &WpChatroomMemberUpsertOne{
+		create: wcmc,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.WpChatroomMember.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (wcmc *WpChatroomMemberCreate) OnConflictColumns(columns ...string) *WpChatroomMemberUpsertOne {
+	wcmc.conflict = append(wcmc.conflict, sql.ConflictColumns(columns...))
+	return &WpChatroomMemberUpsertOne{
+		create: wcmc,
+	}
+}
+
+type (
+	// WpChatroomMemberUpsertOne is the builder for "upsert"-ing
+	//  one WpChatroomMember node.
+	WpChatroomMemberUpsertOne struct {
+		create *WpChatroomMemberCreate
+	}
+
+	// WpChatroomMemberUpsert is the "OnConflict" setter.
+	WpChatroomMemberUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *WpChatroomMemberUpsert) SetUpdatedAt(v time.Time) *WpChatroomMemberUpsert {
+	u.Set(wpchatroommember.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsert) UpdateUpdatedAt() *WpChatroomMemberUpsert {
+	u.SetExcluded(wpchatroommember.FieldUpdatedAt)
+	return u
+}
+
+// SetStatus sets the "status" field.
+func (u *WpChatroomMemberUpsert) SetStatus(v uint8) *WpChatroomMemberUpsert {
+	u.Set(wpchatroommember.FieldStatus, v)
+	return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsert) UpdateStatus() *WpChatroomMemberUpsert {
+	u.SetExcluded(wpchatroommember.FieldStatus)
+	return u
+}
+
+// AddStatus adds v to the "status" field.
+func (u *WpChatroomMemberUpsert) AddStatus(v uint8) *WpChatroomMemberUpsert {
+	u.Add(wpchatroommember.FieldStatus, v)
+	return u
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *WpChatroomMemberUpsert) ClearStatus() *WpChatroomMemberUpsert {
+	u.SetNull(wpchatroommember.FieldStatus)
+	return u
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (u *WpChatroomMemberUpsert) SetWxWxid(v string) *WpChatroomMemberUpsert {
+	u.Set(wpchatroommember.FieldWxWxid, v)
+	return u
+}
+
+// UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsert) UpdateWxWxid() *WpChatroomMemberUpsert {
+	u.SetExcluded(wpchatroommember.FieldWxWxid)
+	return u
+}
+
+// SetWxid sets the "wxid" field.
+func (u *WpChatroomMemberUpsert) SetWxid(v string) *WpChatroomMemberUpsert {
+	u.Set(wpchatroommember.FieldWxid, v)
+	return u
+}
+
+// UpdateWxid sets the "wxid" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsert) UpdateWxid() *WpChatroomMemberUpsert {
+	u.SetExcluded(wpchatroommember.FieldWxid)
+	return u
+}
+
+// SetNickname sets the "nickname" field.
+func (u *WpChatroomMemberUpsert) SetNickname(v string) *WpChatroomMemberUpsert {
+	u.Set(wpchatroommember.FieldNickname, v)
+	return u
+}
+
+// UpdateNickname sets the "nickname" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsert) UpdateNickname() *WpChatroomMemberUpsert {
+	u.SetExcluded(wpchatroommember.FieldNickname)
+	return u
+}
+
+// SetAvatar sets the "avatar" field.
+func (u *WpChatroomMemberUpsert) SetAvatar(v string) *WpChatroomMemberUpsert {
+	u.Set(wpchatroommember.FieldAvatar, v)
+	return u
+}
+
+// UpdateAvatar sets the "avatar" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsert) UpdateAvatar() *WpChatroomMemberUpsert {
+	u.SetExcluded(wpchatroommember.FieldAvatar)
+	return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
+// Using this option is equivalent to using:
+//
+//	client.WpChatroomMember.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(wpchatroommember.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *WpChatroomMemberUpsertOne) UpdateNewValues() *WpChatroomMemberUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		if _, exists := u.create.mutation.ID(); exists {
+			s.SetIgnore(wpchatroommember.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(wpchatroommember.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.WpChatroomMember.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *WpChatroomMemberUpsertOne) Ignore() *WpChatroomMemberUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *WpChatroomMemberUpsertOne) DoNothing() *WpChatroomMemberUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the WpChatroomMemberCreate.OnConflict
+// documentation for more info.
+func (u *WpChatroomMemberUpsertOne) Update(set func(*WpChatroomMemberUpsert)) *WpChatroomMemberUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&WpChatroomMemberUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *WpChatroomMemberUpsertOne) SetUpdatedAt(v time.Time) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertOne) UpdateUpdatedAt() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *WpChatroomMemberUpsertOne) SetStatus(v uint8) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *WpChatroomMemberUpsertOne) AddStatus(v uint8) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertOne) UpdateStatus() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *WpChatroomMemberUpsertOne) ClearStatus() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (u *WpChatroomMemberUpsertOne) SetWxWxid(v string) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetWxWxid(v)
+	})
+}
+
+// UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertOne) UpdateWxWxid() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateWxWxid()
+	})
+}
+
+// SetWxid sets the "wxid" field.
+func (u *WpChatroomMemberUpsertOne) SetWxid(v string) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetWxid(v)
+	})
+}
+
+// UpdateWxid sets the "wxid" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertOne) UpdateWxid() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateWxid()
+	})
+}
+
+// SetNickname sets the "nickname" field.
+func (u *WpChatroomMemberUpsertOne) SetNickname(v string) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetNickname(v)
+	})
+}
+
+// UpdateNickname sets the "nickname" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertOne) UpdateNickname() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateNickname()
+	})
+}
+
+// SetAvatar sets the "avatar" field.
+func (u *WpChatroomMemberUpsertOne) SetAvatar(v string) *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetAvatar(v)
+	})
+}
+
+// UpdateAvatar sets the "avatar" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertOne) UpdateAvatar() *WpChatroomMemberUpsertOne {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateAvatar()
+	})
+}
+
+// Exec executes the query.
+func (u *WpChatroomMemberUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for WpChatroomMemberCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *WpChatroomMemberUpsertOne) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *WpChatroomMemberUpsertOne) ID(ctx context.Context) (id uint64, err error) {
+	node, err := u.create.Save(ctx)
+	if err != nil {
+		return id, err
+	}
+	return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *WpChatroomMemberUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// WpChatroomMemberCreateBulk is the builder for creating many WpChatroomMember entities in bulk.
+type WpChatroomMemberCreateBulk struct {
+	config
+	err      error
+	builders []*WpChatroomMemberCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the WpChatroomMember entities in the database.
+func (wcmcb *WpChatroomMemberCreateBulk) Save(ctx context.Context) ([]*WpChatroomMember, error) {
+	if wcmcb.err != nil {
+		return nil, wcmcb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(wcmcb.builders))
+	nodes := make([]*WpChatroomMember, len(wcmcb.builders))
+	mutators := make([]Mutator, len(wcmcb.builders))
+	for i := range wcmcb.builders {
+		func(i int, root context.Context) {
+			builder := wcmcb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*WpChatroomMemberMutation)
+				if !ok {
+					return nil, fmt.Errorf("unexpected mutation type %T", m)
+				}
+				if err := builder.check(); err != nil {
+					return nil, err
+				}
+				builder.mutation = mutation
+				var err error
+				nodes[i], specs[i] = builder.createSpec()
+				if i < len(mutators)-1 {
+					_, err = mutators[i+1].Mutate(root, wcmcb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = wcmcb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, wcmcb.driver, spec); err != nil {
+						if sqlgraph.IsConstraintError(err) {
+							err = &ConstraintError{msg: err.Error(), wrap: err}
+						}
+					}
+				}
+				if err != nil {
+					return nil, err
+				}
+				mutation.id = &nodes[i].ID
+				if specs[i].ID.Value != nil && nodes[i].ID == 0 {
+					id := specs[i].ID.Value.(int64)
+					nodes[i].ID = uint64(id)
+				}
+				mutation.done = true
+				return nodes[i], nil
+			})
+			for i := len(builder.hooks) - 1; i >= 0; i-- {
+				mut = builder.hooks[i](mut)
+			}
+			mutators[i] = mut
+		}(i, ctx)
+	}
+	if len(mutators) > 0 {
+		if _, err := mutators[0].Mutate(ctx, wcmcb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (wcmcb *WpChatroomMemberCreateBulk) SaveX(ctx context.Context) []*WpChatroomMember {
+	v, err := wcmcb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (wcmcb *WpChatroomMemberCreateBulk) Exec(ctx context.Context) error {
+	_, err := wcmcb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcmcb *WpChatroomMemberCreateBulk) ExecX(ctx context.Context) {
+	if err := wcmcb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.WpChatroomMember.CreateBulk(builders...).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.WpChatroomMemberUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (wcmcb *WpChatroomMemberCreateBulk) OnConflict(opts ...sql.ConflictOption) *WpChatroomMemberUpsertBulk {
+	wcmcb.conflict = opts
+	return &WpChatroomMemberUpsertBulk{
+		create: wcmcb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.WpChatroomMember.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (wcmcb *WpChatroomMemberCreateBulk) OnConflictColumns(columns ...string) *WpChatroomMemberUpsertBulk {
+	wcmcb.conflict = append(wcmcb.conflict, sql.ConflictColumns(columns...))
+	return &WpChatroomMemberUpsertBulk{
+		create: wcmcb,
+	}
+}
+
+// WpChatroomMemberUpsertBulk is the builder for "upsert"-ing
+// a bulk of WpChatroomMember nodes.
+type WpChatroomMemberUpsertBulk struct {
+	create *WpChatroomMemberCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.WpChatroomMember.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(wpchatroommember.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *WpChatroomMemberUpsertBulk) UpdateNewValues() *WpChatroomMemberUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		for _, b := range u.create.builders {
+			if _, exists := b.mutation.ID(); exists {
+				s.SetIgnore(wpchatroommember.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(wpchatroommember.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.WpChatroomMember.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *WpChatroomMemberUpsertBulk) Ignore() *WpChatroomMemberUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *WpChatroomMemberUpsertBulk) DoNothing() *WpChatroomMemberUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the WpChatroomMemberCreateBulk.OnConflict
+// documentation for more info.
+func (u *WpChatroomMemberUpsertBulk) Update(set func(*WpChatroomMemberUpsert)) *WpChatroomMemberUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&WpChatroomMemberUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *WpChatroomMemberUpsertBulk) SetUpdatedAt(v time.Time) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertBulk) UpdateUpdatedAt() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *WpChatroomMemberUpsertBulk) SetStatus(v uint8) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *WpChatroomMemberUpsertBulk) AddStatus(v uint8) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertBulk) UpdateStatus() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *WpChatroomMemberUpsertBulk) ClearStatus() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (u *WpChatroomMemberUpsertBulk) SetWxWxid(v string) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetWxWxid(v)
+	})
+}
+
+// UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertBulk) UpdateWxWxid() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateWxWxid()
+	})
+}
+
+// SetWxid sets the "wxid" field.
+func (u *WpChatroomMemberUpsertBulk) SetWxid(v string) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetWxid(v)
+	})
+}
+
+// UpdateWxid sets the "wxid" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertBulk) UpdateWxid() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateWxid()
+	})
+}
+
+// SetNickname sets the "nickname" field.
+func (u *WpChatroomMemberUpsertBulk) SetNickname(v string) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetNickname(v)
+	})
+}
+
+// UpdateNickname sets the "nickname" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertBulk) UpdateNickname() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateNickname()
+	})
+}
+
+// SetAvatar sets the "avatar" field.
+func (u *WpChatroomMemberUpsertBulk) SetAvatar(v string) *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.SetAvatar(v)
+	})
+}
+
+// UpdateAvatar sets the "avatar" field to the value that was provided on create.
+func (u *WpChatroomMemberUpsertBulk) UpdateAvatar() *WpChatroomMemberUpsertBulk {
+	return u.Update(func(s *WpChatroomMemberUpsert) {
+		s.UpdateAvatar()
+	})
+}
+
+// Exec executes the query.
+func (u *WpChatroomMemberUpsertBulk) Exec(ctx context.Context) error {
+	if u.create.err != nil {
+		return u.create.err
+	}
+	for i, b := range u.create.builders {
+		if len(b.conflict) != 0 {
+			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the WpChatroomMemberCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for WpChatroomMemberCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *WpChatroomMemberUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/wpchatroommember_delete.go

@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/wpchatroommember"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomMemberDelete is the builder for deleting a WpChatroomMember entity.
+type WpChatroomMemberDelete struct {
+	config
+	hooks    []Hook
+	mutation *WpChatroomMemberMutation
+}
+
+// Where appends a list predicates to the WpChatroomMemberDelete builder.
+func (wcmd *WpChatroomMemberDelete) Where(ps ...predicate.WpChatroomMember) *WpChatroomMemberDelete {
+	wcmd.mutation.Where(ps...)
+	return wcmd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (wcmd *WpChatroomMemberDelete) Exec(ctx context.Context) (int, error) {
+	return withHooks(ctx, wcmd.sqlExec, wcmd.mutation, wcmd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcmd *WpChatroomMemberDelete) ExecX(ctx context.Context) int {
+	n, err := wcmd.Exec(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return n
+}
+
+func (wcmd *WpChatroomMemberDelete) sqlExec(ctx context.Context) (int, error) {
+	_spec := sqlgraph.NewDeleteSpec(wpchatroommember.Table, sqlgraph.NewFieldSpec(wpchatroommember.FieldID, field.TypeUint64))
+	if ps := wcmd.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	affected, err := sqlgraph.DeleteNodes(ctx, wcmd.driver, _spec)
+	if err != nil && sqlgraph.IsConstraintError(err) {
+		err = &ConstraintError{msg: err.Error(), wrap: err}
+	}
+	wcmd.mutation.done = true
+	return affected, err
+}
+
+// WpChatroomMemberDeleteOne is the builder for deleting a single WpChatroomMember entity.
+type WpChatroomMemberDeleteOne struct {
+	wcmd *WpChatroomMemberDelete
+}
+
+// Where appends a list predicates to the WpChatroomMemberDelete builder.
+func (wcmdo *WpChatroomMemberDeleteOne) Where(ps ...predicate.WpChatroomMember) *WpChatroomMemberDeleteOne {
+	wcmdo.wcmd.mutation.Where(ps...)
+	return wcmdo
+}
+
+// Exec executes the deletion query.
+func (wcmdo *WpChatroomMemberDeleteOne) Exec(ctx context.Context) error {
+	n, err := wcmdo.wcmd.Exec(ctx)
+	switch {
+	case err != nil:
+		return err
+	case n == 0:
+		return &NotFoundError{wpchatroommember.Label}
+	default:
+		return nil
+	}
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcmdo *WpChatroomMemberDeleteOne) ExecX(ctx context.Context) {
+	if err := wcmdo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 526 - 0
ent/wpchatroommember_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/wpchatroommember"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomMemberQuery is the builder for querying WpChatroomMember entities.
+type WpChatroomMemberQuery struct {
+	config
+	ctx        *QueryContext
+	order      []wpchatroommember.OrderOption
+	inters     []Interceptor
+	predicates []predicate.WpChatroomMember
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the WpChatroomMemberQuery builder.
+func (wcmq *WpChatroomMemberQuery) Where(ps ...predicate.WpChatroomMember) *WpChatroomMemberQuery {
+	wcmq.predicates = append(wcmq.predicates, ps...)
+	return wcmq
+}
+
+// Limit the number of records to be returned by this query.
+func (wcmq *WpChatroomMemberQuery) Limit(limit int) *WpChatroomMemberQuery {
+	wcmq.ctx.Limit = &limit
+	return wcmq
+}
+
+// Offset to start from.
+func (wcmq *WpChatroomMemberQuery) Offset(offset int) *WpChatroomMemberQuery {
+	wcmq.ctx.Offset = &offset
+	return wcmq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (wcmq *WpChatroomMemberQuery) Unique(unique bool) *WpChatroomMemberQuery {
+	wcmq.ctx.Unique = &unique
+	return wcmq
+}
+
+// Order specifies how the records should be ordered.
+func (wcmq *WpChatroomMemberQuery) Order(o ...wpchatroommember.OrderOption) *WpChatroomMemberQuery {
+	wcmq.order = append(wcmq.order, o...)
+	return wcmq
+}
+
+// First returns the first WpChatroomMember entity from the query.
+// Returns a *NotFoundError when no WpChatroomMember was found.
+func (wcmq *WpChatroomMemberQuery) First(ctx context.Context) (*WpChatroomMember, error) {
+	nodes, err := wcmq.Limit(1).All(setContextOp(ctx, wcmq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{wpchatroommember.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) FirstX(ctx context.Context) *WpChatroomMember {
+	node, err := wcmq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first WpChatroomMember ID from the query.
+// Returns a *NotFoundError when no WpChatroomMember ID was found.
+func (wcmq *WpChatroomMemberQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = wcmq.Limit(1).IDs(setContextOp(ctx, wcmq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{wpchatroommember.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := wcmq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single WpChatroomMember entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one WpChatroomMember entity is found.
+// Returns a *NotFoundError when no WpChatroomMember entities are found.
+func (wcmq *WpChatroomMemberQuery) Only(ctx context.Context) (*WpChatroomMember, error) {
+	nodes, err := wcmq.Limit(2).All(setContextOp(ctx, wcmq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{wpchatroommember.Label}
+	default:
+		return nil, &NotSingularError{wpchatroommember.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) OnlyX(ctx context.Context) *WpChatroomMember {
+	node, err := wcmq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only WpChatroomMember ID in the query.
+// Returns a *NotSingularError when more than one WpChatroomMember ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (wcmq *WpChatroomMemberQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = wcmq.Limit(2).IDs(setContextOp(ctx, wcmq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{wpchatroommember.Label}
+	default:
+		err = &NotSingularError{wpchatroommember.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := wcmq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of WpChatroomMembers.
+func (wcmq *WpChatroomMemberQuery) All(ctx context.Context) ([]*WpChatroomMember, error) {
+	ctx = setContextOp(ctx, wcmq.ctx, "All")
+	if err := wcmq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*WpChatroomMember, *WpChatroomMemberQuery]()
+	return withInterceptors[[]*WpChatroomMember](ctx, wcmq, qr, wcmq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) AllX(ctx context.Context) []*WpChatroomMember {
+	nodes, err := wcmq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of WpChatroomMember IDs.
+func (wcmq *WpChatroomMemberQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if wcmq.ctx.Unique == nil && wcmq.path != nil {
+		wcmq.Unique(true)
+	}
+	ctx = setContextOp(ctx, wcmq.ctx, "IDs")
+	if err = wcmq.Select(wpchatroommember.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := wcmq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (wcmq *WpChatroomMemberQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, wcmq.ctx, "Count")
+	if err := wcmq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, wcmq, querierCount[*WpChatroomMemberQuery](), wcmq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) CountX(ctx context.Context) int {
+	count, err := wcmq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (wcmq *WpChatroomMemberQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, wcmq.ctx, "Exist")
+	switch _, err := wcmq.FirstID(ctx); {
+	case IsNotFound(err):
+		return false, nil
+	case err != nil:
+		return false, fmt.Errorf("ent: check existence: %w", err)
+	default:
+		return true, nil
+	}
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (wcmq *WpChatroomMemberQuery) ExistX(ctx context.Context) bool {
+	exist, err := wcmq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the WpChatroomMemberQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (wcmq *WpChatroomMemberQuery) Clone() *WpChatroomMemberQuery {
+	if wcmq == nil {
+		return nil
+	}
+	return &WpChatroomMemberQuery{
+		config:     wcmq.config,
+		ctx:        wcmq.ctx.Clone(),
+		order:      append([]wpchatroommember.OrderOption{}, wcmq.order...),
+		inters:     append([]Interceptor{}, wcmq.inters...),
+		predicates: append([]predicate.WpChatroomMember{}, wcmq.predicates...),
+		// clone intermediate query.
+		sql:  wcmq.sql.Clone(),
+		path: wcmq.path,
+	}
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//		Count int `json:"count,omitempty"`
+//	}
+//
+//	client.WpChatroomMember.Query().
+//		GroupBy(wpchatroommember.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (wcmq *WpChatroomMemberQuery) GroupBy(field string, fields ...string) *WpChatroomMemberGroupBy {
+	wcmq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &WpChatroomMemberGroupBy{build: wcmq}
+	grbuild.flds = &wcmq.ctx.Fields
+	grbuild.label = wpchatroommember.Label
+	grbuild.scan = grbuild.Scan
+	return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//	}
+//
+//	client.WpChatroomMember.Query().
+//		Select(wpchatroommember.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (wcmq *WpChatroomMemberQuery) Select(fields ...string) *WpChatroomMemberSelect {
+	wcmq.ctx.Fields = append(wcmq.ctx.Fields, fields...)
+	sbuild := &WpChatroomMemberSelect{WpChatroomMemberQuery: wcmq}
+	sbuild.label = wpchatroommember.Label
+	sbuild.flds, sbuild.scan = &wcmq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a WpChatroomMemberSelect configured with the given aggregations.
+func (wcmq *WpChatroomMemberQuery) Aggregate(fns ...AggregateFunc) *WpChatroomMemberSelect {
+	return wcmq.Select().Aggregate(fns...)
+}
+
+func (wcmq *WpChatroomMemberQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range wcmq.inters {
+		if inter == nil {
+			return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+		}
+		if trv, ok := inter.(Traverser); ok {
+			if err := trv.Traverse(ctx, wcmq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range wcmq.ctx.Fields {
+		if !wpchatroommember.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if wcmq.path != nil {
+		prev, err := wcmq.path(ctx)
+		if err != nil {
+			return err
+		}
+		wcmq.sql = prev
+	}
+	return nil
+}
+
+func (wcmq *WpChatroomMemberQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*WpChatroomMember, error) {
+	var (
+		nodes = []*WpChatroomMember{}
+		_spec = wcmq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*WpChatroomMember).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &WpChatroomMember{config: wcmq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, wcmq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (wcmq *WpChatroomMemberQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := wcmq.querySpec()
+	_spec.Node.Columns = wcmq.ctx.Fields
+	if len(wcmq.ctx.Fields) > 0 {
+		_spec.Unique = wcmq.ctx.Unique != nil && *wcmq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, wcmq.driver, _spec)
+}
+
+func (wcmq *WpChatroomMemberQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(wpchatroommember.Table, wpchatroommember.Columns, sqlgraph.NewFieldSpec(wpchatroommember.FieldID, field.TypeUint64))
+	_spec.From = wcmq.sql
+	if unique := wcmq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if wcmq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := wcmq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, wpchatroommember.FieldID)
+		for i := range fields {
+			if fields[i] != wpchatroommember.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := wcmq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := wcmq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := wcmq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := wcmq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (wcmq *WpChatroomMemberQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(wcmq.driver.Dialect())
+	t1 := builder.Table(wpchatroommember.Table)
+	columns := wcmq.ctx.Fields
+	if len(columns) == 0 {
+		columns = wpchatroommember.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if wcmq.sql != nil {
+		selector = wcmq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if wcmq.ctx.Unique != nil && *wcmq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range wcmq.predicates {
+		p(selector)
+	}
+	for _, p := range wcmq.order {
+		p(selector)
+	}
+	if offset := wcmq.ctx.Offset; offset != nil {
+		// limit is mandatory for offset clause. We start
+		// with default value, and override it below if needed.
+		selector.Offset(*offset).Limit(math.MaxInt32)
+	}
+	if limit := wcmq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// WpChatroomMemberGroupBy is the group-by builder for WpChatroomMember entities.
+type WpChatroomMemberGroupBy struct {
+	selector
+	build *WpChatroomMemberQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (wcmgb *WpChatroomMemberGroupBy) Aggregate(fns ...AggregateFunc) *WpChatroomMemberGroupBy {
+	wcmgb.fns = append(wcmgb.fns, fns...)
+	return wcmgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (wcmgb *WpChatroomMemberGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, wcmgb.build.ctx, "GroupBy")
+	if err := wcmgb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*WpChatroomMemberQuery, *WpChatroomMemberGroupBy](ctx, wcmgb.build, wcmgb, wcmgb.build.inters, v)
+}
+
+func (wcmgb *WpChatroomMemberGroupBy) sqlScan(ctx context.Context, root *WpChatroomMemberQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(wcmgb.fns))
+	for _, fn := range wcmgb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*wcmgb.flds)+len(wcmgb.fns))
+		for _, f := range *wcmgb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*wcmgb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := wcmgb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// WpChatroomMemberSelect is the builder for selecting fields of WpChatroomMember entities.
+type WpChatroomMemberSelect struct {
+	*WpChatroomMemberQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (wcms *WpChatroomMemberSelect) Aggregate(fns ...AggregateFunc) *WpChatroomMemberSelect {
+	wcms.fns = append(wcms.fns, fns...)
+	return wcms
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (wcms *WpChatroomMemberSelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, wcms.ctx, "Select")
+	if err := wcms.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*WpChatroomMemberQuery, *WpChatroomMemberSelect](ctx, wcms.WpChatroomMemberQuery, wcms, wcms.inters, v)
+}
+
+func (wcms *WpChatroomMemberSelect) sqlScan(ctx context.Context, root *WpChatroomMemberQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(wcms.fns))
+	for _, fn := range wcms.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*wcms.selector.flds); {
+	case n == 0 && len(aggregation) > 0:
+		selector.Select(aggregation...)
+	case n != 0 && len(aggregation) > 0:
+		selector.AppendSelect(aggregation...)
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := wcms.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 420 - 0
ent/wpchatroommember_update.go

@@ -0,0 +1,420 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/predicate"
+	"wechat-api/ent/wpchatroommember"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// WpChatroomMemberUpdate is the builder for updating WpChatroomMember entities.
+type WpChatroomMemberUpdate struct {
+	config
+	hooks    []Hook
+	mutation *WpChatroomMemberMutation
+}
+
+// Where appends a list predicates to the WpChatroomMemberUpdate builder.
+func (wcmu *WpChatroomMemberUpdate) Where(ps ...predicate.WpChatroomMember) *WpChatroomMemberUpdate {
+	wcmu.mutation.Where(ps...)
+	return wcmu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (wcmu *WpChatroomMemberUpdate) SetUpdatedAt(t time.Time) *WpChatroomMemberUpdate {
+	wcmu.mutation.SetUpdatedAt(t)
+	return wcmu
+}
+
+// SetStatus sets the "status" field.
+func (wcmu *WpChatroomMemberUpdate) SetStatus(u uint8) *WpChatroomMemberUpdate {
+	wcmu.mutation.ResetStatus()
+	wcmu.mutation.SetStatus(u)
+	return wcmu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (wcmu *WpChatroomMemberUpdate) SetNillableStatus(u *uint8) *WpChatroomMemberUpdate {
+	if u != nil {
+		wcmu.SetStatus(*u)
+	}
+	return wcmu
+}
+
+// AddStatus adds u to the "status" field.
+func (wcmu *WpChatroomMemberUpdate) AddStatus(u int8) *WpChatroomMemberUpdate {
+	wcmu.mutation.AddStatus(u)
+	return wcmu
+}
+
+// ClearStatus clears the value of the "status" field.
+func (wcmu *WpChatroomMemberUpdate) ClearStatus() *WpChatroomMemberUpdate {
+	wcmu.mutation.ClearStatus()
+	return wcmu
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (wcmu *WpChatroomMemberUpdate) SetWxWxid(s string) *WpChatroomMemberUpdate {
+	wcmu.mutation.SetWxWxid(s)
+	return wcmu
+}
+
+// SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
+func (wcmu *WpChatroomMemberUpdate) SetNillableWxWxid(s *string) *WpChatroomMemberUpdate {
+	if s != nil {
+		wcmu.SetWxWxid(*s)
+	}
+	return wcmu
+}
+
+// SetWxid sets the "wxid" field.
+func (wcmu *WpChatroomMemberUpdate) SetWxid(s string) *WpChatroomMemberUpdate {
+	wcmu.mutation.SetWxid(s)
+	return wcmu
+}
+
+// SetNillableWxid sets the "wxid" field if the given value is not nil.
+func (wcmu *WpChatroomMemberUpdate) SetNillableWxid(s *string) *WpChatroomMemberUpdate {
+	if s != nil {
+		wcmu.SetWxid(*s)
+	}
+	return wcmu
+}
+
+// SetNickname sets the "nickname" field.
+func (wcmu *WpChatroomMemberUpdate) SetNickname(s string) *WpChatroomMemberUpdate {
+	wcmu.mutation.SetNickname(s)
+	return wcmu
+}
+
+// SetNillableNickname sets the "nickname" field if the given value is not nil.
+func (wcmu *WpChatroomMemberUpdate) SetNillableNickname(s *string) *WpChatroomMemberUpdate {
+	if s != nil {
+		wcmu.SetNickname(*s)
+	}
+	return wcmu
+}
+
+// SetAvatar sets the "avatar" field.
+func (wcmu *WpChatroomMemberUpdate) SetAvatar(s string) *WpChatroomMemberUpdate {
+	wcmu.mutation.SetAvatar(s)
+	return wcmu
+}
+
+// SetNillableAvatar sets the "avatar" field if the given value is not nil.
+func (wcmu *WpChatroomMemberUpdate) SetNillableAvatar(s *string) *WpChatroomMemberUpdate {
+	if s != nil {
+		wcmu.SetAvatar(*s)
+	}
+	return wcmu
+}
+
+// Mutation returns the WpChatroomMemberMutation object of the builder.
+func (wcmu *WpChatroomMemberUpdate) Mutation() *WpChatroomMemberMutation {
+	return wcmu.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (wcmu *WpChatroomMemberUpdate) Save(ctx context.Context) (int, error) {
+	wcmu.defaults()
+	return withHooks(ctx, wcmu.sqlSave, wcmu.mutation, wcmu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (wcmu *WpChatroomMemberUpdate) SaveX(ctx context.Context) int {
+	affected, err := wcmu.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (wcmu *WpChatroomMemberUpdate) Exec(ctx context.Context) error {
+	_, err := wcmu.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcmu *WpChatroomMemberUpdate) ExecX(ctx context.Context) {
+	if err := wcmu.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (wcmu *WpChatroomMemberUpdate) defaults() {
+	if _, ok := wcmu.mutation.UpdatedAt(); !ok {
+		v := wpchatroommember.UpdateDefaultUpdatedAt()
+		wcmu.mutation.SetUpdatedAt(v)
+	}
+}
+
+func (wcmu *WpChatroomMemberUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(wpchatroommember.Table, wpchatroommember.Columns, sqlgraph.NewFieldSpec(wpchatroommember.FieldID, field.TypeUint64))
+	if ps := wcmu.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := wcmu.mutation.UpdatedAt(); ok {
+		_spec.SetField(wpchatroommember.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := wcmu.mutation.Status(); ok {
+		_spec.SetField(wpchatroommember.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := wcmu.mutation.AddedStatus(); ok {
+		_spec.AddField(wpchatroommember.FieldStatus, field.TypeUint8, value)
+	}
+	if wcmu.mutation.StatusCleared() {
+		_spec.ClearField(wpchatroommember.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := wcmu.mutation.WxWxid(); ok {
+		_spec.SetField(wpchatroommember.FieldWxWxid, field.TypeString, value)
+	}
+	if value, ok := wcmu.mutation.Wxid(); ok {
+		_spec.SetField(wpchatroommember.FieldWxid, field.TypeString, value)
+	}
+	if value, ok := wcmu.mutation.Nickname(); ok {
+		_spec.SetField(wpchatroommember.FieldNickname, field.TypeString, value)
+	}
+	if value, ok := wcmu.mutation.Avatar(); ok {
+		_spec.SetField(wpchatroommember.FieldAvatar, field.TypeString, value)
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, wcmu.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{wpchatroommember.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	wcmu.mutation.done = true
+	return n, nil
+}
+
+// WpChatroomMemberUpdateOne is the builder for updating a single WpChatroomMember entity.
+type WpChatroomMemberUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *WpChatroomMemberMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (wcmuo *WpChatroomMemberUpdateOne) SetUpdatedAt(t time.Time) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.SetUpdatedAt(t)
+	return wcmuo
+}
+
+// SetStatus sets the "status" field.
+func (wcmuo *WpChatroomMemberUpdateOne) SetStatus(u uint8) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.ResetStatus()
+	wcmuo.mutation.SetStatus(u)
+	return wcmuo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (wcmuo *WpChatroomMemberUpdateOne) SetNillableStatus(u *uint8) *WpChatroomMemberUpdateOne {
+	if u != nil {
+		wcmuo.SetStatus(*u)
+	}
+	return wcmuo
+}
+
+// AddStatus adds u to the "status" field.
+func (wcmuo *WpChatroomMemberUpdateOne) AddStatus(u int8) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.AddStatus(u)
+	return wcmuo
+}
+
+// ClearStatus clears the value of the "status" field.
+func (wcmuo *WpChatroomMemberUpdateOne) ClearStatus() *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.ClearStatus()
+	return wcmuo
+}
+
+// SetWxWxid sets the "wx_wxid" field.
+func (wcmuo *WpChatroomMemberUpdateOne) SetWxWxid(s string) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.SetWxWxid(s)
+	return wcmuo
+}
+
+// SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
+func (wcmuo *WpChatroomMemberUpdateOne) SetNillableWxWxid(s *string) *WpChatroomMemberUpdateOne {
+	if s != nil {
+		wcmuo.SetWxWxid(*s)
+	}
+	return wcmuo
+}
+
+// SetWxid sets the "wxid" field.
+func (wcmuo *WpChatroomMemberUpdateOne) SetWxid(s string) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.SetWxid(s)
+	return wcmuo
+}
+
+// SetNillableWxid sets the "wxid" field if the given value is not nil.
+func (wcmuo *WpChatroomMemberUpdateOne) SetNillableWxid(s *string) *WpChatroomMemberUpdateOne {
+	if s != nil {
+		wcmuo.SetWxid(*s)
+	}
+	return wcmuo
+}
+
+// SetNickname sets the "nickname" field.
+func (wcmuo *WpChatroomMemberUpdateOne) SetNickname(s string) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.SetNickname(s)
+	return wcmuo
+}
+
+// SetNillableNickname sets the "nickname" field if the given value is not nil.
+func (wcmuo *WpChatroomMemberUpdateOne) SetNillableNickname(s *string) *WpChatroomMemberUpdateOne {
+	if s != nil {
+		wcmuo.SetNickname(*s)
+	}
+	return wcmuo
+}
+
+// SetAvatar sets the "avatar" field.
+func (wcmuo *WpChatroomMemberUpdateOne) SetAvatar(s string) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.SetAvatar(s)
+	return wcmuo
+}
+
+// SetNillableAvatar sets the "avatar" field if the given value is not nil.
+func (wcmuo *WpChatroomMemberUpdateOne) SetNillableAvatar(s *string) *WpChatroomMemberUpdateOne {
+	if s != nil {
+		wcmuo.SetAvatar(*s)
+	}
+	return wcmuo
+}
+
+// Mutation returns the WpChatroomMemberMutation object of the builder.
+func (wcmuo *WpChatroomMemberUpdateOne) Mutation() *WpChatroomMemberMutation {
+	return wcmuo.mutation
+}
+
+// Where appends a list predicates to the WpChatroomMemberUpdate builder.
+func (wcmuo *WpChatroomMemberUpdateOne) Where(ps ...predicate.WpChatroomMember) *WpChatroomMemberUpdateOne {
+	wcmuo.mutation.Where(ps...)
+	return wcmuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (wcmuo *WpChatroomMemberUpdateOne) Select(field string, fields ...string) *WpChatroomMemberUpdateOne {
+	wcmuo.fields = append([]string{field}, fields...)
+	return wcmuo
+}
+
+// Save executes the query and returns the updated WpChatroomMember entity.
+func (wcmuo *WpChatroomMemberUpdateOne) Save(ctx context.Context) (*WpChatroomMember, error) {
+	wcmuo.defaults()
+	return withHooks(ctx, wcmuo.sqlSave, wcmuo.mutation, wcmuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (wcmuo *WpChatroomMemberUpdateOne) SaveX(ctx context.Context) *WpChatroomMember {
+	node, err := wcmuo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (wcmuo *WpChatroomMemberUpdateOne) Exec(ctx context.Context) error {
+	_, err := wcmuo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (wcmuo *WpChatroomMemberUpdateOne) ExecX(ctx context.Context) {
+	if err := wcmuo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (wcmuo *WpChatroomMemberUpdateOne) defaults() {
+	if _, ok := wcmuo.mutation.UpdatedAt(); !ok {
+		v := wpchatroommember.UpdateDefaultUpdatedAt()
+		wcmuo.mutation.SetUpdatedAt(v)
+	}
+}
+
+func (wcmuo *WpChatroomMemberUpdateOne) sqlSave(ctx context.Context) (_node *WpChatroomMember, err error) {
+	_spec := sqlgraph.NewUpdateSpec(wpchatroommember.Table, wpchatroommember.Columns, sqlgraph.NewFieldSpec(wpchatroommember.FieldID, field.TypeUint64))
+	id, ok := wcmuo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "WpChatroomMember.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := wcmuo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, wpchatroommember.FieldID)
+		for _, f := range fields {
+			if !wpchatroommember.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != wpchatroommember.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := wcmuo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := wcmuo.mutation.UpdatedAt(); ok {
+		_spec.SetField(wpchatroommember.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := wcmuo.mutation.Status(); ok {
+		_spec.SetField(wpchatroommember.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := wcmuo.mutation.AddedStatus(); ok {
+		_spec.AddField(wpchatroommember.FieldStatus, field.TypeUint8, value)
+	}
+	if wcmuo.mutation.StatusCleared() {
+		_spec.ClearField(wpchatroommember.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := wcmuo.mutation.WxWxid(); ok {
+		_spec.SetField(wpchatroommember.FieldWxWxid, field.TypeString, value)
+	}
+	if value, ok := wcmuo.mutation.Wxid(); ok {
+		_spec.SetField(wpchatroommember.FieldWxid, field.TypeString, value)
+	}
+	if value, ok := wcmuo.mutation.Nickname(); ok {
+		_spec.SetField(wpchatroommember.FieldNickname, field.TypeString, value)
+	}
+	if value, ok := wcmuo.mutation.Avatar(); ok {
+		_spec.SetField(wpchatroommember.FieldAvatar, field.TypeString, value)
+	}
+	_node = &WpChatroomMember{config: wcmuo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, wcmuo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{wpchatroommember.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	wcmuo.mutation.done = true
+	return _node, nil
+}

+ 5 - 1
etc/wechat-docker.yaml

@@ -76,4 +76,8 @@ Aliyun:
   ACCESS_KEY_ID: LTAI5tSJwCQyuaxXR3UxfnWw
   ACCESS_KEY_SECRET: 0pv4xhSPJv9IPSxrkB52FspJk27W7V
   OSS_ENDPOINT: sts.cn-beijing.aliyuncs.com
-  OSS_ROLEARN: acs:ram::1317798064750399:role/ramoss
+  OSS_ROLEARN: acs:ram::1317798064750399:role/ramoss
+
+Fastgpt:
+  BASE_URL: http://new-api.gkscrm.com/v1
+  API_KEY: sk-ZQRNypQOC8ID5WbpCdF263C58dF44271842e86D408Bb3848

+ 35 - 0
hook/contact.go

@@ -138,3 +138,38 @@ func (h *Hook) TriggerChatroomPush(wxWxid string) error {
 
 	return nil
 }
+
+func (h *Hook) AddFriendInChatRoom(ChatRoomId, wxWxid, friendId, desc string) error {
+	conn, err := h.connWorkPhone()
+	if err != nil {
+		err = fmt.Errorf("AddFriendInChatRoom failed")
+		return err
+	}
+	defer func(conn *websocket.Conn) {
+		err = conn.Close()
+		if err != nil {
+			err = fmt.Errorf("AddFriendInChatRoom failed")
+		}
+	}(conn)
+
+	message := map[string]interface{}{
+		"MsgType": "AddFriendInChatRoomTask",
+		"Content": map[string]interface{}{
+			"WeChatId":   wxWxid,
+			"ChatroomId": ChatRoomId,
+			"FriendId":   friendId,
+			"Message":    desc,
+		},
+	}
+	transportMessageJSON, err := json.Marshal(message)
+	if err != nil {
+		return err
+	}
+	// 发送 JSON 消息
+	err = conn.WriteMessage(websocket.TextMessage, transportMessageJSON)
+	if err != nil {
+		return fmt.Errorf("failed to send message: %v", err)
+	}
+
+	return nil
+}

+ 49 - 23
internal/logic/ChatRoomMember/get_chatroom_member_list_logic.go

@@ -2,9 +2,11 @@ package ChatRoomMember
 
 import (
 	"context"
+	"wechat-api/ent/wpchatroom"
+	"wechat-api/ent/wpchatroommember"
+	"wechat-api/hook"
 
 	"wechat-api/ent/wx"
-	"wechat-api/hook"
 	"wechat-api/internal/svc"
 	"wechat-api/internal/types"
 
@@ -34,21 +36,6 @@ func (l *GetChatroomMemberListLogic) GetChatroomMemberList(req *types.ChatroomMe
 		return
 	}
 
-	serverInfo, err := l.svcCtx.DB.Server.Get(l.ctx, wxInfo.ServerID)
-	if err != nil {
-		l.Error("查询服务器信息失败", err)
-		return
-	}
-
-	hookClient := hook.NewHook(serverInfo.PrivateIP, serverInfo.AdminPort, wxInfo.Port)
-
-	chatrooMmemberDetail, err := hookClient.GetChatrooMmemberDetail(*req.ChatRoom)
-
-	if err != nil {
-		l.Error("获取群成员详细信息失败", err)
-		return
-	}
-
 	resp = &types.ChatroomMemberListResp{
 		BaseDataInfo: types.BaseDataInfo{
 			Code: 0,
@@ -56,13 +43,52 @@ func (l *GetChatroomMemberListLogic) GetChatroomMemberList(req *types.ChatroomMe
 		},
 	}
 
-	for _, v := range chatrooMmemberDetail.Member {
-		resp.Data.Data = append(resp.Data.Data, types.ChatroomMemberInfo{
-			Wxid:      &v.Wxid,
-			ChatRoom:  req.ChatRoom,
-			OwnerWxid: req.OwnerWxid,
-			Account:   &v.Nickname,
-		})
+	if wxInfo.ServerID == 0 {
+		hookClient := hook.NewHook("", "", "")
+		_ = hookClient.RequestChatRoomInfo(*req.ChatRoom, wxInfo.Wxid)
+		// 获取群成员
+		wpChatroom, _ := l.svcCtx.DB.WpChatroom.Query().
+			Where(wpchatroom.WxWxid(*req.OwnerWxid), wpchatroom.ChatroomID(*req.ChatRoom)).
+			Only(l.ctx)
+		if wpChatroom != nil && wpChatroom.MemberList != nil {
+			for _, m := range wpChatroom.MemberList {
+				member, _ := l.svcCtx.DB.WpChatroomMember.Query().
+					Where(wpchatroommember.WxWxidEQ(*req.OwnerWxid), wpchatroommember.WxidEQ(m)).
+					Only(l.ctx)
+				if member != nil {
+					resp.Data.Data = append(resp.Data.Data, types.ChatroomMemberInfo{
+						Wxid:      &m,
+						ChatRoom:  req.ChatRoom,
+						OwnerWxid: req.OwnerWxid,
+						Account:   &member.Nickname,
+					})
+				}
+			}
+		}
+	} else {
+		serverInfo, err := l.svcCtx.DB.Server.Get(l.ctx, wxInfo.ServerID)
+		if err != nil {
+			l.Error("查询服务器信息失败", err)
+			return nil, err
+		}
+
+		hookClient := hook.NewHook(serverInfo.PrivateIP, serverInfo.AdminPort, wxInfo.Port)
+
+		chatrooMmemberDetail, err := hookClient.GetChatrooMmemberDetail(*req.ChatRoom)
+
+		if err != nil {
+			l.Error("获取群成员详细信息失败", err)
+			return nil, err
+		}
+
+		for _, v := range chatrooMmemberDetail.Member {
+			resp.Data.Data = append(resp.Data.Data, types.ChatroomMemberInfo{
+				Wxid:      &v.Wxid,
+				ChatRoom:  req.ChatRoom,
+				OwnerWxid: req.OwnerWxid,
+				Account:   &v.Nickname,
+			})
+		}
 	}
 
 	return resp, nil

+ 48 - 39
internal/logic/contact/add_new_friend_logic.go

@@ -2,9 +2,9 @@ package contact
 
 import (
 	"context"
+	"wechat-api/hook"
 
 	"wechat-api/ent/wx"
-	"wechat-api/hook"
 	"wechat-api/internal/svc"
 	"wechat-api/internal/types"
 
@@ -25,50 +25,59 @@ func NewAddNewFriendLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddN
 		svcCtx: svcCtx}
 }
 
-func (l *AddNewFriendLogic) AddNewFriend(req *types.AddNewFriendReq) (resp *types.BaseMsgResp, err error) {
+func (l *AddNewFriendLogic) AddNewFriend(req *types.AddNewFriendReq) (*types.BaseMsgResp, error) {
 	organizationId := l.ctx.Value("organizationId").(uint64)
 	wxInfo, err := l.svcCtx.DB.Wx.Query().Where(wx.Wxid(req.OwnerWxid), wx.OrganizationIDEQ(organizationId)).First(l.ctx)
 	if err != nil {
 		l.Error("查询微信信息失败", err)
-		return
-	}
-
-	serverInfo, err := l.svcCtx.DB.Server.Get(l.ctx, wxInfo.ServerID)
-	if err != nil {
-		l.Error("查询服务器信息失败", err)
-		return
-	}
-
-	hookClient := hook.NewHook(serverInfo.PrivateIP, serverInfo.AdminPort, wxInfo.Port)
-
-	//通过群id获取群成员详细信息
-	ChatroomMemberDetailInfo, err := hookClient.GetChatroomMemberDetailInfo(req.Gid, req.Wxid)
-
-	if err != nil {
-		l.Error("获取群成员详细信息失败", err)
-		return
-	}
-
-	v3 := req.Wxid
-	v4 := ""
-
-	if ChatroomMemberDetailInfo.V3 != "" {
-		v3 = ChatroomMemberDetailInfo.V3
-	}
-
-	if ChatroomMemberDetailInfo.V4 != "" {
-		v4 = ChatroomMemberDetailInfo.V4
-	}
-
-	AddNewFriendResult, err := hookClient.AddNewFriend(v3, v4, req.Desc, req.AddType, "0")
-	if err != nil {
-		l.Error("添加好友失败", err)
-		return
+		return nil, err
 	}
 
-	if AddNewFriendResult.Status != "0" {
-		l.Error("添加好友失败", err)
-		return
+	if wxInfo.ServerID == 0 {
+		hookClient := hook.NewHook("", "", "")
+		err = hookClient.AddFriendInChatRoom(req.Gid, req.OwnerWxid, req.Wxid, req.Desc)
+		if err != nil {
+			l.Error("添加好友失败", err)
+			return nil, err
+		}
+	} else {
+		serverInfo, err := l.svcCtx.DB.Server.Get(l.ctx, wxInfo.ServerID)
+		if err != nil {
+			l.Error("查询服务器信息失败", err)
+			return nil, err
+		}
+
+		hookClient := hook.NewHook(serverInfo.PrivateIP, serverInfo.AdminPort, wxInfo.Port)
+
+		//通过群id获取群成员详细信息
+		ChatroomMemberDetailInfo, err := hookClient.GetChatroomMemberDetailInfo(req.Gid, req.Wxid)
+
+		if err != nil {
+			l.Error("获取群成员详细信息失败", err)
+			return nil, err
+		}
+
+		v3 := req.Wxid
+		v4 := ""
+
+		if ChatroomMemberDetailInfo.V3 != "" {
+			v3 = ChatroomMemberDetailInfo.V3
+		}
+
+		if ChatroomMemberDetailInfo.V4 != "" {
+			v4 = ChatroomMemberDetailInfo.V4
+		}
+
+		AddNewFriendResult, err := hookClient.AddNewFriend(v3, v4, req.Desc, req.AddType, "0")
+		if err != nil {
+			l.Error("添加好友失败", err)
+			return nil, err
+		}
+
+		if AddNewFriendResult.Status != "0" {
+			l.Error("添加好友失败", err)
+			return nil, err
+		}
 	}
 
 	return &types.BaseMsgResp{Msg: errormsg.Success}, nil

+ 13 - 8
internal/logic/sop_node/update_sop_node_logic.go

@@ -96,15 +96,20 @@ func (l *UpdateSopNodeLogic) UpdateSopNode(req *types.SopNodeInfo) (*types.BaseM
 		forward = nil
 	}
 
+	var noReplyCondition uint64
+	if req.NoReplyCondition == nil {
+		noReplyCondition = 0
+	} else {
+		noReplyCondition = *req.NoReplyCondition
+	}
+
 	createStmt := l.svcCtx.DB.SopNode.UpdateOneID(*req.Id).
-		SetNotNilStatus(req.Status).
-		SetNotNilStageID(req.StageId).
-		SetNotNilParentID(req.ParentId).
-		SetNotNilName(req.Name).
-		SetNotNilConditionType(req.ConditionType).
-		SetNotNilConditionList(req.ConditionList).
-		SetNotNilNoReplyCondition(req.NoReplyCondition).
-		SetNotNilNoReplyUnit(req.NoReplyUnit).
+		SetStageID(*req.StageId).
+		SetName(*req.Name).
+		SetConditionType(*req.ConditionType).
+		SetConditionList(req.ConditionList).
+		SetNoReplyCondition(noReplyCondition).
+		SetNoReplyUnit(*req.NoReplyUnit).
 		SetNotNilActionMessage(actionMessage).
 		SetNotNilActionLabelAdd(req.ActionLabelAdd).
 		SetNotNilActionLabelDel(req.ActionLabelDel)