|
@@ -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
|