|
@@ -21,6 +21,7 @@ import (
|
|
|
"wechat-api/ent/employeeconfig"
|
|
|
"wechat-api/ent/label"
|
|
|
"wechat-api/ent/labelrelationship"
|
|
|
+ "wechat-api/ent/labeltagging"
|
|
|
"wechat-api/ent/message"
|
|
|
"wechat-api/ent/messagerecords"
|
|
|
"wechat-api/ent/msg"
|
|
@@ -69,6 +70,7 @@ const (
|
|
|
TypeEmployeeConfig = "EmployeeConfig"
|
|
|
TypeLabel = "Label"
|
|
|
TypeLabelRelationship = "LabelRelationship"
|
|
|
+ TypeLabelTagging = "LabelTagging"
|
|
|
TypeMessage = "Message"
|
|
|
TypeMessageRecords = "MessageRecords"
|
|
|
TypeMsg = "Msg"
|
|
@@ -13997,6 +13999,986 @@ func (m *LabelRelationshipMutation) ResetEdge(name string) error {
|
|
|
return fmt.Errorf("unknown LabelRelationship edge %s", name)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+type LabelTaggingMutation struct {
|
|
|
+ config
|
|
|
+ op Op
|
|
|
+ typ string
|
|
|
+ id *uint64
|
|
|
+ created_at *time.Time
|
|
|
+ updated_at *time.Time
|
|
|
+ status *uint8
|
|
|
+ addstatus *int8
|
|
|
+ deleted_at *time.Time
|
|
|
+ organization_id *uint64
|
|
|
+ addorganization_id *int64
|
|
|
+ _type *int
|
|
|
+ add_type *int
|
|
|
+ conditions *string
|
|
|
+ action_label_add *[]uint64
|
|
|
+ appendaction_label_add []uint64
|
|
|
+ action_label_del *[]uint64
|
|
|
+ appendaction_label_del []uint64
|
|
|
+ clearedFields map[string]struct{}
|
|
|
+ done bool
|
|
|
+ oldValue func(context.Context) (*LabelTagging, error)
|
|
|
+ predicates []predicate.LabelTagging
|
|
|
+}
|
|
|
+
|
|
|
+var _ ent.Mutation = (*LabelTaggingMutation)(nil)
|
|
|
+
|
|
|
+
|
|
|
+type labeltaggingOption func(*LabelTaggingMutation)
|
|
|
+
|
|
|
+
|
|
|
+func newLabelTaggingMutation(c config, op Op, opts ...labeltaggingOption) *LabelTaggingMutation {
|
|
|
+ m := &LabelTaggingMutation{
|
|
|
+ config: c,
|
|
|
+ op: op,
|
|
|
+ typ: TypeLabelTagging,
|
|
|
+ clearedFields: make(map[string]struct{}),
|
|
|
+ }
|
|
|
+ for _, opt := range opts {
|
|
|
+ opt(m)
|
|
|
+ }
|
|
|
+ return m
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func withLabelTaggingID(id uint64) labeltaggingOption {
|
|
|
+ return func(m *LabelTaggingMutation) {
|
|
|
+ var (
|
|
|
+ err error
|
|
|
+ once sync.Once
|
|
|
+ value *LabelTagging
|
|
|
+ )
|
|
|
+ m.oldValue = func(ctx context.Context) (*LabelTagging, error) {
|
|
|
+ once.Do(func() {
|
|
|
+ if m.done {
|
|
|
+ err = errors.New("querying old values post mutation is not allowed")
|
|
|
+ } else {
|
|
|
+ value, err = m.Client().LabelTagging.Get(ctx, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return value, err
|
|
|
+ }
|
|
|
+ m.id = &id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func withLabelTagging(node *LabelTagging) labeltaggingOption {
|
|
|
+ return func(m *LabelTaggingMutation) {
|
|
|
+ m.oldValue = func(context.Context) (*LabelTagging, error) {
|
|
|
+ return node, nil
|
|
|
+ }
|
|
|
+ m.id = &node.ID
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m LabelTaggingMutation) Client() *Client {
|
|
|
+ client := &Client{config: m.config}
|
|
|
+ client.init()
|
|
|
+ return client
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m LabelTaggingMutation) 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
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetID(id uint64) {
|
|
|
+ m.id = &id
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ID() (id uint64, exists bool) {
|
|
|
+ if m.id == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *m.id, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) 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().LabelTagging.Query().Where(m.predicates...).IDs(ctx)
|
|
|
+ default:
|
|
|
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetCreatedAt(t time.Time) {
|
|
|
+ m.created_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) CreatedAt() (r time.Time, exists bool) {
|
|
|
+ v := m.created_at
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) 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
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetCreatedAt() {
|
|
|
+ m.created_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetUpdatedAt(t time.Time) {
|
|
|
+ m.updated_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) UpdatedAt() (r time.Time, exists bool) {
|
|
|
+ v := m.updated_at
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) 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
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetUpdatedAt() {
|
|
|
+ m.updated_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetStatus(u uint8) {
|
|
|
+ m.status = &u
|
|
|
+ m.addstatus = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Status() (r uint8, exists bool) {
|
|
|
+ v := m.status
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) 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
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddStatus(u int8) {
|
|
|
+ if m.addstatus != nil {
|
|
|
+ *m.addstatus += u
|
|
|
+ } else {
|
|
|
+ m.addstatus = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedStatus() (r int8, exists bool) {
|
|
|
+ v := m.addstatus
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ m.clearedFields[labeltagging.FieldStatus] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) StatusCleared() bool {
|
|
|
+ _, ok := m.clearedFields[labeltagging.FieldStatus]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ delete(m.clearedFields, labeltagging.FieldStatus)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetDeletedAt(t time.Time) {
|
|
|
+ m.deleted_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) DeletedAt() (r time.Time, exists bool) {
|
|
|
+ v := m.deleted_at
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldDeletedAt requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.DeletedAt, nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ m.clearedFields[labeltagging.FieldDeletedAt] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) DeletedAtCleared() bool {
|
|
|
+ _, ok := m.clearedFields[labeltagging.FieldDeletedAt]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ delete(m.clearedFields, labeltagging.FieldDeletedAt)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetOrganizationID(u uint64) {
|
|
|
+ m.organization_id = &u
|
|
|
+ m.addorganization_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OrganizationID() (r uint64, exists bool) {
|
|
|
+ v := m.organization_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldOrganizationID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldOrganizationID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldOrganizationID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldOrganizationID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.OrganizationID, nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddOrganizationID(u int64) {
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ *m.addorganization_id += u
|
|
|
+ } else {
|
|
|
+ m.addorganization_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedOrganizationID() (r int64, exists bool) {
|
|
|
+ v := m.addorganization_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetType(i int) {
|
|
|
+ m._type = &i
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) GetType() (r int, exists bool) {
|
|
|
+ v := m._type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldType(ctx context.Context) (v int, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldType is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldType requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldType: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Type, nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddType(i int) {
|
|
|
+ if m.add_type != nil {
|
|
|
+ *m.add_type += i
|
|
|
+ } else {
|
|
|
+ m.add_type = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedType() (r int, exists bool) {
|
|
|
+ v := m.add_type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetType() {
|
|
|
+ m._type = nil
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetConditions(s string) {
|
|
|
+ m.conditions = &s
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Conditions() (r string, exists bool) {
|
|
|
+ v := m.conditions
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldConditions(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldConditions is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldConditions requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldConditions: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Conditions, nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetConditions() {
|
|
|
+ m.conditions = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetActionLabelAdd(u []uint64) {
|
|
|
+ m.action_label_add = &u
|
|
|
+ m.appendaction_label_add = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ActionLabelAdd() (r []uint64, exists bool) {
|
|
|
+ v := m.action_label_add
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldActionLabelAdd(ctx context.Context) (v []uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldActionLabelAdd is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldActionLabelAdd requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldActionLabelAdd: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ActionLabelAdd, nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AppendActionLabelAdd(u []uint64) {
|
|
|
+ m.appendaction_label_add = append(m.appendaction_label_add, u...)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AppendedActionLabelAdd() ([]uint64, bool) {
|
|
|
+ if len(m.appendaction_label_add) == 0 {
|
|
|
+ return nil, false
|
|
|
+ }
|
|
|
+ return m.appendaction_label_add, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearActionLabelAdd() {
|
|
|
+ m.action_label_add = nil
|
|
|
+ m.appendaction_label_add = nil
|
|
|
+ m.clearedFields[labeltagging.FieldActionLabelAdd] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ActionLabelAddCleared() bool {
|
|
|
+ _, ok := m.clearedFields[labeltagging.FieldActionLabelAdd]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetActionLabelAdd() {
|
|
|
+ m.action_label_add = nil
|
|
|
+ m.appendaction_label_add = nil
|
|
|
+ delete(m.clearedFields, labeltagging.FieldActionLabelAdd)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetActionLabelDel(u []uint64) {
|
|
|
+ m.action_label_del = &u
|
|
|
+ m.appendaction_label_del = nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ActionLabelDel() (r []uint64, exists bool) {
|
|
|
+ v := m.action_label_del
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldActionLabelDel(ctx context.Context) (v []uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldActionLabelDel is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldActionLabelDel requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldActionLabelDel: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ActionLabelDel, nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AppendActionLabelDel(u []uint64) {
|
|
|
+ m.appendaction_label_del = append(m.appendaction_label_del, u...)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AppendedActionLabelDel() ([]uint64, bool) {
|
|
|
+ if len(m.appendaction_label_del) == 0 {
|
|
|
+ return nil, false
|
|
|
+ }
|
|
|
+ return m.appendaction_label_del, true
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearActionLabelDel() {
|
|
|
+ m.action_label_del = nil
|
|
|
+ m.appendaction_label_del = nil
|
|
|
+ m.clearedFields[labeltagging.FieldActionLabelDel] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ActionLabelDelCleared() bool {
|
|
|
+ _, ok := m.clearedFields[labeltagging.FieldActionLabelDel]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetActionLabelDel() {
|
|
|
+ m.action_label_del = nil
|
|
|
+ m.appendaction_label_del = nil
|
|
|
+ delete(m.clearedFields, labeltagging.FieldActionLabelDel)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Where(ps ...predicate.LabelTagging) {
|
|
|
+ m.predicates = append(m.predicates, ps...)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
|
+ p := make([]predicate.LabelTagging, len(ps))
|
|
|
+ for i := range ps {
|
|
|
+ p[i] = ps[i]
|
|
|
+ }
|
|
|
+ m.Where(p...)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Op() Op {
|
|
|
+ return m.op
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetOp(op Op) {
|
|
|
+ m.op = op
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Type() string {
|
|
|
+ return m.typ
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Fields() []string {
|
|
|
+ fields := make([]string, 0, 9)
|
|
|
+ if m.created_at != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldCreatedAt)
|
|
|
+ }
|
|
|
+ if m.updated_at != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldUpdatedAt)
|
|
|
+ }
|
|
|
+ if m.status != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.deleted_at != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.organization_id != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m._type != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldType)
|
|
|
+ }
|
|
|
+ if m.conditions != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldConditions)
|
|
|
+ }
|
|
|
+ if m.action_label_add != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldActionLabelAdd)
|
|
|
+ }
|
|
|
+ if m.action_label_del != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldActionLabelDel)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) Field(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.FieldCreatedAt:
|
|
|
+ return m.CreatedAt()
|
|
|
+ case labeltagging.FieldUpdatedAt:
|
|
|
+ return m.UpdatedAt()
|
|
|
+ case labeltagging.FieldStatus:
|
|
|
+ return m.Status()
|
|
|
+ case labeltagging.FieldDeletedAt:
|
|
|
+ return m.DeletedAt()
|
|
|
+ case labeltagging.FieldOrganizationID:
|
|
|
+ return m.OrganizationID()
|
|
|
+ case labeltagging.FieldType:
|
|
|
+ return m.GetType()
|
|
|
+ case labeltagging.FieldConditions:
|
|
|
+ return m.Conditions()
|
|
|
+ case labeltagging.FieldActionLabelAdd:
|
|
|
+ return m.ActionLabelAdd()
|
|
|
+ case labeltagging.FieldActionLabelDel:
|
|
|
+ return m.ActionLabelDel()
|
|
|
+ }
|
|
|
+ return nil, false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.FieldCreatedAt:
|
|
|
+ return m.OldCreatedAt(ctx)
|
|
|
+ case labeltagging.FieldUpdatedAt:
|
|
|
+ return m.OldUpdatedAt(ctx)
|
|
|
+ case labeltagging.FieldStatus:
|
|
|
+ return m.OldStatus(ctx)
|
|
|
+ case labeltagging.FieldDeletedAt:
|
|
|
+ return m.OldDeletedAt(ctx)
|
|
|
+ case labeltagging.FieldOrganizationID:
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
+ case labeltagging.FieldType:
|
|
|
+ return m.OldType(ctx)
|
|
|
+ case labeltagging.FieldConditions:
|
|
|
+ return m.OldConditions(ctx)
|
|
|
+ case labeltagging.FieldActionLabelAdd:
|
|
|
+ return m.OldActionLabelAdd(ctx)
|
|
|
+ case labeltagging.FieldActionLabelDel:
|
|
|
+ return m.OldActionLabelDel(ctx)
|
|
|
+ }
|
|
|
+ return nil, fmt.Errorf("unknown LabelTagging field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) SetField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.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 labeltagging.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 labeltagging.FieldStatus:
|
|
|
+ v, ok := value.(uint8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetStatus(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldDeletedAt:
|
|
|
+ v, ok := value.(time.Time)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetDeletedAt(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldOrganizationID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetType(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldConditions:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetConditions(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldActionLabelAdd:
|
|
|
+ v, ok := value.([]uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetActionLabelAdd(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldActionLabelDel:
|
|
|
+ v, ok := value.([]uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetActionLabelDel(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown LabelTagging field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.addstatus != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.add_type != nil {
|
|
|
+ fields = append(fields, labeltagging.FieldType)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.FieldStatus:
|
|
|
+ return m.AddedStatus()
|
|
|
+ case labeltagging.FieldOrganizationID:
|
|
|
+ return m.AddedOrganizationID()
|
|
|
+ case labeltagging.FieldType:
|
|
|
+ return m.AddedType()
|
|
|
+ }
|
|
|
+ return nil, false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.FieldStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddStatus(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldOrganizationID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddType(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown LabelTagging numeric field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.FieldCleared(labeltagging.FieldStatus) {
|
|
|
+ fields = append(fields, labeltagging.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(labeltagging.FieldDeletedAt) {
|
|
|
+ fields = append(fields, labeltagging.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(labeltagging.FieldActionLabelAdd) {
|
|
|
+ fields = append(fields, labeltagging.FieldActionLabelAdd)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(labeltagging.FieldActionLabelDel) {
|
|
|
+ fields = append(fields, labeltagging.FieldActionLabelDel)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) FieldCleared(name string) bool {
|
|
|
+ _, ok := m.clearedFields[name]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.FieldStatus:
|
|
|
+ m.ClearStatus()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldDeletedAt:
|
|
|
+ m.ClearDeletedAt()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldActionLabelAdd:
|
|
|
+ m.ClearActionLabelAdd()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldActionLabelDel:
|
|
|
+ m.ClearActionLabelDel()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown LabelTagging nullable field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case labeltagging.FieldCreatedAt:
|
|
|
+ m.ResetCreatedAt()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldUpdatedAt:
|
|
|
+ m.ResetUpdatedAt()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldStatus:
|
|
|
+ m.ResetStatus()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldDeletedAt:
|
|
|
+ m.ResetDeletedAt()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldOrganizationID:
|
|
|
+ m.ResetOrganizationID()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldType:
|
|
|
+ m.ResetType()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldConditions:
|
|
|
+ m.ResetConditions()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldActionLabelAdd:
|
|
|
+ m.ResetActionLabelAdd()
|
|
|
+ return nil
|
|
|
+ case labeltagging.FieldActionLabelDel:
|
|
|
+ m.ResetActionLabelDel()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown LabelTagging field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedEdges() []string {
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
+ return edges
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) RemovedEdges() []string {
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
+ return edges
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) RemovedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearedEdges() []string {
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
+ return edges
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) EdgeCleared(name string) bool {
|
|
|
+ return false
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ClearEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown LabelTagging unique edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *LabelTaggingMutation) ResetEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown LabelTagging edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
type MessageMutation struct {
|
|
|
config
|