|
@@ -22201,19 +22201,21 @@ func (m *SopTaskMutation) ResetEdge(name string) error {
|
|
|
// TokenMutation represents an operation that mutates the Token nodes in the graph.
|
|
|
type TokenMutation struct {
|
|
|
config
|
|
|
- op Op
|
|
|
- typ string
|
|
|
- id *uint64
|
|
|
- created_at *time.Time
|
|
|
- updated_at *time.Time
|
|
|
- deleted_at *time.Time
|
|
|
- expire_at *time.Time
|
|
|
- token *string
|
|
|
- mac *string
|
|
|
- clearedFields map[string]struct{}
|
|
|
- done bool
|
|
|
- oldValue func(context.Context) (*Token, error)
|
|
|
- predicates []predicate.Token
|
|
|
+ op Op
|
|
|
+ typ string
|
|
|
+ id *uint64
|
|
|
+ created_at *time.Time
|
|
|
+ updated_at *time.Time
|
|
|
+ deleted_at *time.Time
|
|
|
+ expire_at *time.Time
|
|
|
+ token *string
|
|
|
+ mac *string
|
|
|
+ organization_id *uint64
|
|
|
+ addorganization_id *int64
|
|
|
+ clearedFields map[string]struct{}
|
|
|
+ done bool
|
|
|
+ oldValue func(context.Context) (*Token, error)
|
|
|
+ predicates []predicate.Token
|
|
|
}
|
|
|
|
|
|
var _ ent.Mutation = (*TokenMutation)(nil)
|
|
@@ -22575,6 +22577,62 @@ func (m *TokenMutation) ResetMAC() {
|
|
|
m.mac = nil
|
|
|
}
|
|
|
|
|
|
+// SetOrganizationID sets the "organization_id" field.
|
|
|
+func (m *TokenMutation) SetOrganizationID(u uint64) {
|
|
|
+ m.organization_id = &u
|
|
|
+ m.addorganization_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// OrganizationID returns the value of the "organization_id" field in the mutation.
|
|
|
+func (m *TokenMutation) OrganizationID() (r uint64, exists bool) {
|
|
|
+ v := m.organization_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldOrganizationID returns the old "organization_id" field's value of the Token entity.
|
|
|
+// If the Token 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 *TokenMutation) 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
|
|
|
+}
|
|
|
+
|
|
|
+// AddOrganizationID adds u to the "organization_id" field.
|
|
|
+func (m *TokenMutation) AddOrganizationID(u int64) {
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ *m.addorganization_id += u
|
|
|
+ } else {
|
|
|
+ m.addorganization_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedOrganizationID returns the value that was added to the "organization_id" field in this mutation.
|
|
|
+func (m *TokenMutation) AddedOrganizationID() (r int64, exists bool) {
|
|
|
+ v := m.addorganization_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOrganizationID resets all changes to the "organization_id" field.
|
|
|
+func (m *TokenMutation) ResetOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the TokenMutation builder.
|
|
|
func (m *TokenMutation) Where(ps ...predicate.Token) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -22609,7 +22667,7 @@ func (m *TokenMutation) Type() string {
|
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
|
// AddedFields().
|
|
|
func (m *TokenMutation) Fields() []string {
|
|
|
- fields := make([]string, 0, 6)
|
|
|
+ fields := make([]string, 0, 7)
|
|
|
if m.created_at != nil {
|
|
|
fields = append(fields, token.FieldCreatedAt)
|
|
|
}
|
|
@@ -22628,6 +22686,9 @@ func (m *TokenMutation) Fields() []string {
|
|
|
if m.mac != nil {
|
|
|
fields = append(fields, token.FieldMAC)
|
|
|
}
|
|
|
+ if m.organization_id != nil {
|
|
|
+ fields = append(fields, token.FieldOrganizationID)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -22648,6 +22709,8 @@ func (m *TokenMutation) Field(name string) (ent.Value, bool) {
|
|
|
return m.Token()
|
|
|
case token.FieldMAC:
|
|
|
return m.MAC()
|
|
|
+ case token.FieldOrganizationID:
|
|
|
+ return m.OrganizationID()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -22669,6 +22732,8 @@ func (m *TokenMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
|
|
return m.OldToken(ctx)
|
|
|
case token.FieldMAC:
|
|
|
return m.OldMAC(ctx)
|
|
|
+ case token.FieldOrganizationID:
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
}
|
|
|
return nil, fmt.Errorf("unknown Token field %s", name)
|
|
|
}
|
|
@@ -22720,6 +22785,13 @@ func (m *TokenMutation) SetField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.SetMAC(v)
|
|
|
return nil
|
|
|
+ case token.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 Token field %s", name)
|
|
|
}
|
|
@@ -22727,13 +22799,21 @@ func (m *TokenMutation) SetField(name string, value ent.Value) error {
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
|
// this mutation.
|
|
|
func (m *TokenMutation) AddedFields() []string {
|
|
|
- return nil
|
|
|
+ var fields []string
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ fields = append(fields, token.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ 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 *TokenMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case token.FieldOrganizationID:
|
|
|
+ return m.AddedOrganizationID()
|
|
|
+ }
|
|
|
return nil, false
|
|
|
}
|
|
|
|
|
@@ -22742,6 +22822,13 @@ func (m *TokenMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
// type.
|
|
|
func (m *TokenMutation) AddField(name string, value ent.Value) error {
|
|
|
switch name {
|
|
|
+ case token.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 Token numeric field %s", name)
|
|
|
}
|
|
@@ -22808,6 +22895,9 @@ func (m *TokenMutation) ResetField(name string) error {
|
|
|
case token.FieldMAC:
|
|
|
m.ResetMAC()
|
|
|
return nil
|
|
|
+ case token.FieldOrganizationID:
|
|
|
+ m.ResetOrganizationID()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Token field %s", name)
|
|
|
}
|