|
@@ -10,6 +10,7 @@ import (
|
|
"time"
|
|
"time"
|
|
"wechat-api/ent/agent"
|
|
"wechat-api/ent/agent"
|
|
"wechat-api/ent/batchmsg"
|
|
"wechat-api/ent/batchmsg"
|
|
|
|
+ "wechat-api/ent/category"
|
|
"wechat-api/ent/contact"
|
|
"wechat-api/ent/contact"
|
|
"wechat-api/ent/custom_types"
|
|
"wechat-api/ent/custom_types"
|
|
"wechat-api/ent/employee"
|
|
"wechat-api/ent/employee"
|
|
@@ -44,6 +45,7 @@ const (
|
|
|
|
|
|
TypeAgent = "Agent"
|
|
TypeAgent = "Agent"
|
|
TypeBatchMsg = "BatchMsg"
|
|
TypeBatchMsg = "BatchMsg"
|
|
|
|
+ TypeCategory = "Category"
|
|
TypeContact = "Contact"
|
|
TypeContact = "Contact"
|
|
TypeEmployee = "Employee"
|
|
TypeEmployee = "Employee"
|
|
TypeEmployeeConfig = "EmployeeConfig"
|
|
TypeEmployeeConfig = "EmployeeConfig"
|
|
@@ -2666,6 +2668,612 @@ func (m *BatchMsgMutation) ResetEdge(name string) error {
|
|
return fmt.Errorf("unknown BatchMsg edge %s", name)
|
|
return fmt.Errorf("unknown BatchMsg edge %s", name)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+type CategoryMutation struct {
|
|
|
|
+ config
|
|
|
|
+ op Op
|
|
|
|
+ typ string
|
|
|
|
+ id *uint64
|
|
|
|
+ created_at *time.Time
|
|
|
|
+ updated_at *time.Time
|
|
|
|
+ deleted_at *time.Time
|
|
|
|
+ name *string
|
|
|
|
+ organization_id *uint64
|
|
|
|
+ addorganization_id *int64
|
|
|
|
+ clearedFields map[string]struct{}
|
|
|
|
+ done bool
|
|
|
|
+ oldValue func(context.Context) (*Category, error)
|
|
|
|
+ predicates []predicate.Category
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+var _ ent.Mutation = (*CategoryMutation)(nil)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+type categoryOption func(*CategoryMutation)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func newCategoryMutation(c config, op Op, opts ...categoryOption) *CategoryMutation {
|
|
|
|
+ m := &CategoryMutation{
|
|
|
|
+ config: c,
|
|
|
|
+ op: op,
|
|
|
|
+ typ: TypeCategory,
|
|
|
|
+ clearedFields: make(map[string]struct{}),
|
|
|
|
+ }
|
|
|
|
+ for _, opt := range opts {
|
|
|
|
+ opt(m)
|
|
|
|
+ }
|
|
|
|
+ return m
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func withCategoryID(id uint64) categoryOption {
|
|
|
|
+ return func(m *CategoryMutation) {
|
|
|
|
+ var (
|
|
|
|
+ err error
|
|
|
|
+ once sync.Once
|
|
|
|
+ value *Category
|
|
|
|
+ )
|
|
|
|
+ m.oldValue = func(ctx context.Context) (*Category, error) {
|
|
|
|
+ once.Do(func() {
|
|
|
|
+ if m.done {
|
|
|
|
+ err = errors.New("querying old values post mutation is not allowed")
|
|
|
|
+ } else {
|
|
|
|
+ value, err = m.Client().Category.Get(ctx, id)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return value, err
|
|
|
|
+ }
|
|
|
|
+ m.id = &id
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func withCategory(node *Category) categoryOption {
|
|
|
|
+ return func(m *CategoryMutation) {
|
|
|
|
+ m.oldValue = func(context.Context) (*Category, error) {
|
|
|
|
+ return node, nil
|
|
|
|
+ }
|
|
|
|
+ m.id = &node.ID
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m CategoryMutation) Client() *Client {
|
|
|
|
+ client := &Client{config: m.config}
|
|
|
|
+ client.init()
|
|
|
|
+ return client
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m CategoryMutation) 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 *CategoryMutation) SetID(id uint64) {
|
|
|
|
+ m.id = &id
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ID() (id uint64, exists bool) {
|
|
|
|
+ if m.id == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *m.id, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) 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().Category.Query().Where(m.predicates...).IDs(ctx)
|
|
|
|
+ default:
|
|
|
|
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetCreatedAt(t time.Time) {
|
|
|
|
+ m.created_at = &t
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) CreatedAt() (r time.Time, exists bool) {
|
|
|
|
+ v := m.created_at
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) 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 *CategoryMutation) ResetCreatedAt() {
|
|
|
|
+ m.created_at = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetUpdatedAt(t time.Time) {
|
|
|
|
+ m.updated_at = &t
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) UpdatedAt() (r time.Time, exists bool) {
|
|
|
|
+ v := m.updated_at
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) 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 *CategoryMutation) ResetUpdatedAt() {
|
|
|
|
+ m.updated_at = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetDeletedAt(t time.Time) {
|
|
|
|
+ m.deleted_at = &t
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) DeletedAt() (r time.Time, exists bool) {
|
|
|
|
+ v := m.deleted_at
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) 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 *CategoryMutation) ClearDeletedAt() {
|
|
|
|
+ m.deleted_at = nil
|
|
|
|
+ m.clearedFields[category.FieldDeletedAt] = struct{}{}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) DeletedAtCleared() bool {
|
|
|
|
+ _, ok := m.clearedFields[category.FieldDeletedAt]
|
|
|
|
+ return ok
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ResetDeletedAt() {
|
|
|
|
+ m.deleted_at = nil
|
|
|
|
+ delete(m.clearedFields, category.FieldDeletedAt)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetName(s string) {
|
|
|
|
+ m.name = &s
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) Name() (r string, exists bool) {
|
|
|
|
+ v := m.name
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) OldName(ctx context.Context) (v string, err error) {
|
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
|
+ return v, errors.New("OldName is only allowed on UpdateOne operations")
|
|
|
|
+ }
|
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
|
+ return v, errors.New("OldName requires an ID field in the mutation")
|
|
|
|
+ }
|
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return v, fmt.Errorf("querying old value for OldName: %w", err)
|
|
|
|
+ }
|
|
|
|
+ return oldValue.Name, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ResetName() {
|
|
|
|
+ m.name = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetOrganizationID(u uint64) {
|
|
|
|
+ m.organization_id = &u
|
|
|
|
+ m.addorganization_id = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) OrganizationID() (r uint64, exists bool) {
|
|
|
|
+ v := m.organization_id
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) 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 *CategoryMutation) AddOrganizationID(u int64) {
|
|
|
|
+ if m.addorganization_id != nil {
|
|
|
|
+ *m.addorganization_id += u
|
|
|
|
+ } else {
|
|
|
|
+ m.addorganization_id = &u
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) AddedOrganizationID() (r int64, exists bool) {
|
|
|
|
+ v := m.addorganization_id
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ResetOrganizationID() {
|
|
|
|
+ m.organization_id = nil
|
|
|
|
+ m.addorganization_id = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) Where(ps ...predicate.Category) {
|
|
|
|
+ m.predicates = append(m.predicates, ps...)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
|
|
+ p := make([]predicate.Category, len(ps))
|
|
|
|
+ for i := range ps {
|
|
|
|
+ p[i] = ps[i]
|
|
|
|
+ }
|
|
|
|
+ m.Where(p...)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) Op() Op {
|
|
|
|
+ return m.op
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetOp(op Op) {
|
|
|
|
+ m.op = op
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) Type() string {
|
|
|
|
+ return m.typ
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) Fields() []string {
|
|
|
|
+ fields := make([]string, 0, 5)
|
|
|
|
+ if m.created_at != nil {
|
|
|
|
+ fields = append(fields, category.FieldCreatedAt)
|
|
|
|
+ }
|
|
|
|
+ if m.updated_at != nil {
|
|
|
|
+ fields = append(fields, category.FieldUpdatedAt)
|
|
|
|
+ }
|
|
|
|
+ if m.deleted_at != nil {
|
|
|
|
+ fields = append(fields, category.FieldDeletedAt)
|
|
|
|
+ }
|
|
|
|
+ if m.name != nil {
|
|
|
|
+ fields = append(fields, category.FieldName)
|
|
|
|
+ }
|
|
|
|
+ if m.organization_id != nil {
|
|
|
|
+ fields = append(fields, category.FieldOrganizationID)
|
|
|
|
+ }
|
|
|
|
+ return fields
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) Field(name string) (ent.Value, bool) {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.FieldCreatedAt:
|
|
|
|
+ return m.CreatedAt()
|
|
|
|
+ case category.FieldUpdatedAt:
|
|
|
|
+ return m.UpdatedAt()
|
|
|
|
+ case category.FieldDeletedAt:
|
|
|
|
+ return m.DeletedAt()
|
|
|
|
+ case category.FieldName:
|
|
|
|
+ return m.Name()
|
|
|
|
+ case category.FieldOrganizationID:
|
|
|
|
+ return m.OrganizationID()
|
|
|
|
+ }
|
|
|
|
+ return nil, false
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.FieldCreatedAt:
|
|
|
|
+ return m.OldCreatedAt(ctx)
|
|
|
|
+ case category.FieldUpdatedAt:
|
|
|
|
+ return m.OldUpdatedAt(ctx)
|
|
|
|
+ case category.FieldDeletedAt:
|
|
|
|
+ return m.OldDeletedAt(ctx)
|
|
|
|
+ case category.FieldName:
|
|
|
|
+ return m.OldName(ctx)
|
|
|
|
+ case category.FieldOrganizationID:
|
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
|
+ }
|
|
|
|
+ return nil, fmt.Errorf("unknown Category field %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) SetField(name string, value ent.Value) error {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.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 category.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 category.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 category.FieldName:
|
|
|
|
+ v, ok := value.(string)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.SetName(v)
|
|
|
|
+ return nil
|
|
|
|
+ case category.FieldOrganizationID:
|
|
|
|
+ v, ok := value.(uint64)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.SetOrganizationID(v)
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
|
|
+ return fmt.Errorf("unknown Category field %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) AddedFields() []string {
|
|
|
|
+ var fields []string
|
|
|
|
+ if m.addorganization_id != nil {
|
|
|
|
+ fields = append(fields, category.FieldOrganizationID)
|
|
|
|
+ }
|
|
|
|
+ return fields
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.FieldOrganizationID:
|
|
|
|
+ return m.AddedOrganizationID()
|
|
|
|
+ }
|
|
|
|
+ return nil, false
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) AddField(name string, value ent.Value) error {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.FieldOrganizationID:
|
|
|
|
+ v, ok := value.(int64)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.AddOrganizationID(v)
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
|
|
+ return fmt.Errorf("unknown Category numeric field %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ClearedFields() []string {
|
|
|
|
+ var fields []string
|
|
|
|
+ if m.FieldCleared(category.FieldDeletedAt) {
|
|
|
|
+ fields = append(fields, category.FieldDeletedAt)
|
|
|
|
+ }
|
|
|
|
+ return fields
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) FieldCleared(name string) bool {
|
|
|
|
+ _, ok := m.clearedFields[name]
|
|
|
|
+ return ok
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ClearField(name string) error {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.FieldDeletedAt:
|
|
|
|
+ m.ClearDeletedAt()
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
|
|
+ return fmt.Errorf("unknown Category nullable field %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ResetField(name string) error {
|
|
|
|
+ switch name {
|
|
|
|
+ case category.FieldCreatedAt:
|
|
|
|
+ m.ResetCreatedAt()
|
|
|
|
+ return nil
|
|
|
|
+ case category.FieldUpdatedAt:
|
|
|
|
+ m.ResetUpdatedAt()
|
|
|
|
+ return nil
|
|
|
|
+ case category.FieldDeletedAt:
|
|
|
|
+ m.ResetDeletedAt()
|
|
|
|
+ return nil
|
|
|
|
+ case category.FieldName:
|
|
|
|
+ m.ResetName()
|
|
|
|
+ return nil
|
|
|
|
+ case category.FieldOrganizationID:
|
|
|
|
+ m.ResetOrganizationID()
|
|
|
|
+ return nil
|
|
|
|
+ }
|
|
|
|
+ return fmt.Errorf("unknown Category field %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) AddedEdges() []string {
|
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
|
+ return edges
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) AddedIDs(name string) []ent.Value {
|
|
|
|
+ return nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) RemovedEdges() []string {
|
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
|
+ return edges
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) RemovedIDs(name string) []ent.Value {
|
|
|
|
+ return nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ClearedEdges() []string {
|
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
|
+ return edges
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) EdgeCleared(name string) bool {
|
|
|
|
+ return false
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ClearEdge(name string) error {
|
|
|
|
+ return fmt.Errorf("unknown Category unique edge %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *CategoryMutation) ResetEdge(name string) error {
|
|
|
|
+ return fmt.Errorf("unknown Category edge %s", name)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
type ContactMutation struct {
|
|
type ContactMutation struct {
|
|
config
|
|
config
|
|
@@ -4529,6 +5137,8 @@ type EmployeeMutation struct {
|
|
video_url *string
|
|
video_url *string
|
|
organization_id *uint64
|
|
organization_id *uint64
|
|
addorganization_id *int64
|
|
addorganization_id *int64
|
|
|
|
+ category_id *uint64
|
|
|
|
+ addcategory_id *int64
|
|
clearedFields map[string]struct{}
|
|
clearedFields map[string]struct{}
|
|
em_work_experiences map[uint64]struct{}
|
|
em_work_experiences map[uint64]struct{}
|
|
removedem_work_experiences map[uint64]struct{}
|
|
removedem_work_experiences map[uint64]struct{}
|
|
@@ -5350,6 +5960,62 @@ func (m *EmployeeMutation) ResetOrganizationID() {
|
|
m.addorganization_id = nil
|
|
m.addorganization_id = nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+func (m *EmployeeMutation) SetCategoryID(u uint64) {
|
|
|
|
+ m.category_id = &u
|
|
|
|
+ m.addcategory_id = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *EmployeeMutation) CategoryID() (r uint64, exists bool) {
|
|
|
|
+ v := m.category_id
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *EmployeeMutation) OldCategoryID(ctx context.Context) (v uint64, err error) {
|
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
|
+ return v, errors.New("OldCategoryID is only allowed on UpdateOne operations")
|
|
|
|
+ }
|
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
|
+ return v, errors.New("OldCategoryID requires an ID field in the mutation")
|
|
|
|
+ }
|
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return v, fmt.Errorf("querying old value for OldCategoryID: %w", err)
|
|
|
|
+ }
|
|
|
|
+ return oldValue.CategoryID, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *EmployeeMutation) AddCategoryID(u int64) {
|
|
|
|
+ if m.addcategory_id != nil {
|
|
|
|
+ *m.addcategory_id += u
|
|
|
|
+ } else {
|
|
|
|
+ m.addcategory_id = &u
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *EmployeeMutation) AddedCategoryID() (r int64, exists bool) {
|
|
|
|
+ v := m.addcategory_id
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func (m *EmployeeMutation) ResetCategoryID() {
|
|
|
|
+ m.category_id = nil
|
|
|
|
+ m.addcategory_id = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
func (m *EmployeeMutation) AddEmWorkExperienceIDs(ids ...uint64) {
|
|
func (m *EmployeeMutation) AddEmWorkExperienceIDs(ids ...uint64) {
|
|
if m.em_work_experiences == nil {
|
|
if m.em_work_experiences == nil {
|
|
@@ -5492,7 +6158,7 @@ func (m *EmployeeMutation) Type() string {
|
|
|
|
|
|
|
|
|
|
func (m *EmployeeMutation) Fields() []string {
|
|
func (m *EmployeeMutation) Fields() []string {
|
|
- fields := make([]string, 0, 17)
|
|
+ fields := make([]string, 0, 18)
|
|
if m.created_at != nil {
|
|
if m.created_at != nil {
|
|
fields = append(fields, employee.FieldCreatedAt)
|
|
fields = append(fields, employee.FieldCreatedAt)
|
|
}
|
|
}
|
|
@@ -5544,6 +6210,9 @@ func (m *EmployeeMutation) Fields() []string {
|
|
if m.organization_id != nil {
|
|
if m.organization_id != nil {
|
|
fields = append(fields, employee.FieldOrganizationID)
|
|
fields = append(fields, employee.FieldOrganizationID)
|
|
}
|
|
}
|
|
|
|
+ if m.category_id != nil {
|
|
|
|
+ fields = append(fields, employee.FieldCategoryID)
|
|
|
|
+ }
|
|
return fields
|
|
return fields
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5586,6 +6255,8 @@ func (m *EmployeeMutation) Field(name string) (ent.Value, bool) {
|
|
return m.VideoURL()
|
|
return m.VideoURL()
|
|
case employee.FieldOrganizationID:
|
|
case employee.FieldOrganizationID:
|
|
return m.OrganizationID()
|
|
return m.OrganizationID()
|
|
|
|
+ case employee.FieldCategoryID:
|
|
|
|
+ return m.CategoryID()
|
|
}
|
|
}
|
|
return nil, false
|
|
return nil, false
|
|
}
|
|
}
|
|
@@ -5629,6 +6300,8 @@ func (m *EmployeeMutation) OldField(ctx context.Context, name string) (ent.Value
|
|
return m.OldVideoURL(ctx)
|
|
return m.OldVideoURL(ctx)
|
|
case employee.FieldOrganizationID:
|
|
case employee.FieldOrganizationID:
|
|
return m.OldOrganizationID(ctx)
|
|
return m.OldOrganizationID(ctx)
|
|
|
|
+ case employee.FieldCategoryID:
|
|
|
|
+ return m.OldCategoryID(ctx)
|
|
}
|
|
}
|
|
return nil, fmt.Errorf("unknown Employee field %s", name)
|
|
return nil, fmt.Errorf("unknown Employee field %s", name)
|
|
}
|
|
}
|
|
@@ -5757,6 +6430,13 @@ func (m *EmployeeMutation) SetField(name string, value ent.Value) error {
|
|
}
|
|
}
|
|
m.SetOrganizationID(v)
|
|
m.SetOrganizationID(v)
|
|
return nil
|
|
return nil
|
|
|
|
+ case employee.FieldCategoryID:
|
|
|
|
+ v, ok := value.(uint64)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.SetCategoryID(v)
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("unknown Employee field %s", name)
|
|
return fmt.Errorf("unknown Employee field %s", name)
|
|
}
|
|
}
|
|
@@ -5777,6 +6457,9 @@ func (m *EmployeeMutation) AddedFields() []string {
|
|
if m.addorganization_id != nil {
|
|
if m.addorganization_id != nil {
|
|
fields = append(fields, employee.FieldOrganizationID)
|
|
fields = append(fields, employee.FieldOrganizationID)
|
|
}
|
|
}
|
|
|
|
+ if m.addcategory_id != nil {
|
|
|
|
+ fields = append(fields, employee.FieldCategoryID)
|
|
|
|
+ }
|
|
return fields
|
|
return fields
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5793,6 +6476,8 @@ func (m *EmployeeMutation) AddedField(name string) (ent.Value, bool) {
|
|
return m.AddedAchievementCount()
|
|
return m.AddedAchievementCount()
|
|
case employee.FieldOrganizationID:
|
|
case employee.FieldOrganizationID:
|
|
return m.AddedOrganizationID()
|
|
return m.AddedOrganizationID()
|
|
|
|
+ case employee.FieldCategoryID:
|
|
|
|
+ return m.AddedCategoryID()
|
|
}
|
|
}
|
|
return nil, false
|
|
return nil, false
|
|
}
|
|
}
|
|
@@ -5830,6 +6515,13 @@ func (m *EmployeeMutation) AddField(name string, value ent.Value) error {
|
|
}
|
|
}
|
|
m.AddOrganizationID(v)
|
|
m.AddOrganizationID(v)
|
|
return nil
|
|
return nil
|
|
|
|
+ case employee.FieldCategoryID:
|
|
|
|
+ v, ok := value.(int64)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.AddCategoryID(v)
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("unknown Employee numeric field %s", name)
|
|
return fmt.Errorf("unknown Employee numeric field %s", name)
|
|
}
|
|
}
|
|
@@ -5917,6 +6609,9 @@ func (m *EmployeeMutation) ResetField(name string) error {
|
|
case employee.FieldOrganizationID:
|
|
case employee.FieldOrganizationID:
|
|
m.ResetOrganizationID()
|
|
m.ResetOrganizationID()
|
|
return nil
|
|
return nil
|
|
|
|
+ case employee.FieldCategoryID:
|
|
|
|
+ m.ResetCategoryID()
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("unknown Employee field %s", name)
|
|
return fmt.Errorf("unknown Employee field %s", name)
|
|
}
|
|
}
|