|
@@ -22212,6 +22212,12 @@ type TokenMutation struct {
|
|
|
mac *string
|
|
|
organization_id *uint64
|
|
|
addorganization_id *int64
|
|
|
+ agent_id *uint64
|
|
|
+ addagent_id *int64
|
|
|
+ custom_agent_base *string
|
|
|
+ custom_agent_key *string
|
|
|
+ openai_base *string
|
|
|
+ openai_key *string
|
|
|
clearedFields map[string]struct{}
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Token, error)
|
|
@@ -22633,6 +22639,258 @@ func (m *TokenMutation) ResetOrganizationID() {
|
|
|
m.addorganization_id = nil
|
|
|
}
|
|
|
|
|
|
+// SetAgentID sets the "agent_id" field.
|
|
|
+func (m *TokenMutation) SetAgentID(u uint64) {
|
|
|
+ m.agent_id = &u
|
|
|
+ m.addagent_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AgentID returns the value of the "agent_id" field in the mutation.
|
|
|
+func (m *TokenMutation) AgentID() (r uint64, exists bool) {
|
|
|
+ v := m.agent_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAgentID returns the old "agent_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) OldAgentID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAgentID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAgentID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAgentID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AgentID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAgentID adds u to the "agent_id" field.
|
|
|
+func (m *TokenMutation) AddAgentID(u int64) {
|
|
|
+ if m.addagent_id != nil {
|
|
|
+ *m.addagent_id += u
|
|
|
+ } else {
|
|
|
+ m.addagent_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAgentID returns the value that was added to the "agent_id" field in this mutation.
|
|
|
+func (m *TokenMutation) AddedAgentID() (r int64, exists bool) {
|
|
|
+ v := m.addagent_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAgentID resets all changes to the "agent_id" field.
|
|
|
+func (m *TokenMutation) ResetAgentID() {
|
|
|
+ m.agent_id = nil
|
|
|
+ m.addagent_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetCustomAgentBase sets the "custom_agent_base" field.
|
|
|
+func (m *TokenMutation) SetCustomAgentBase(s string) {
|
|
|
+ m.custom_agent_base = &s
|
|
|
+}
|
|
|
+
|
|
|
+// CustomAgentBase returns the value of the "custom_agent_base" field in the mutation.
|
|
|
+func (m *TokenMutation) CustomAgentBase() (r string, exists bool) {
|
|
|
+ v := m.custom_agent_base
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldCustomAgentBase returns the old "custom_agent_base" 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) OldCustomAgentBase(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldCustomAgentBase is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldCustomAgentBase requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldCustomAgentBase: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.CustomAgentBase, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearCustomAgentBase clears the value of the "custom_agent_base" field.
|
|
|
+func (m *TokenMutation) ClearCustomAgentBase() {
|
|
|
+ m.custom_agent_base = nil
|
|
|
+ m.clearedFields[token.FieldCustomAgentBase] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// CustomAgentBaseCleared returns if the "custom_agent_base" field was cleared in this mutation.
|
|
|
+func (m *TokenMutation) CustomAgentBaseCleared() bool {
|
|
|
+ _, ok := m.clearedFields[token.FieldCustomAgentBase]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetCustomAgentBase resets all changes to the "custom_agent_base" field.
|
|
|
+func (m *TokenMutation) ResetCustomAgentBase() {
|
|
|
+ m.custom_agent_base = nil
|
|
|
+ delete(m.clearedFields, token.FieldCustomAgentBase)
|
|
|
+}
|
|
|
+
|
|
|
+// SetCustomAgentKey sets the "custom_agent_key" field.
|
|
|
+func (m *TokenMutation) SetCustomAgentKey(s string) {
|
|
|
+ m.custom_agent_key = &s
|
|
|
+}
|
|
|
+
|
|
|
+// CustomAgentKey returns the value of the "custom_agent_key" field in the mutation.
|
|
|
+func (m *TokenMutation) CustomAgentKey() (r string, exists bool) {
|
|
|
+ v := m.custom_agent_key
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldCustomAgentKey returns the old "custom_agent_key" 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) OldCustomAgentKey(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldCustomAgentKey is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldCustomAgentKey requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldCustomAgentKey: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.CustomAgentKey, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearCustomAgentKey clears the value of the "custom_agent_key" field.
|
|
|
+func (m *TokenMutation) ClearCustomAgentKey() {
|
|
|
+ m.custom_agent_key = nil
|
|
|
+ m.clearedFields[token.FieldCustomAgentKey] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// CustomAgentKeyCleared returns if the "custom_agent_key" field was cleared in this mutation.
|
|
|
+func (m *TokenMutation) CustomAgentKeyCleared() bool {
|
|
|
+ _, ok := m.clearedFields[token.FieldCustomAgentKey]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetCustomAgentKey resets all changes to the "custom_agent_key" field.
|
|
|
+func (m *TokenMutation) ResetCustomAgentKey() {
|
|
|
+ m.custom_agent_key = nil
|
|
|
+ delete(m.clearedFields, token.FieldCustomAgentKey)
|
|
|
+}
|
|
|
+
|
|
|
+// SetOpenaiBase sets the "openai_base" field.
|
|
|
+func (m *TokenMutation) SetOpenaiBase(s string) {
|
|
|
+ m.openai_base = &s
|
|
|
+}
|
|
|
+
|
|
|
+// OpenaiBase returns the value of the "openai_base" field in the mutation.
|
|
|
+func (m *TokenMutation) OpenaiBase() (r string, exists bool) {
|
|
|
+ v := m.openai_base
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldOpenaiBase returns the old "openai_base" 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) OldOpenaiBase(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldOpenaiBase is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldOpenaiBase requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldOpenaiBase: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.OpenaiBase, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearOpenaiBase clears the value of the "openai_base" field.
|
|
|
+func (m *TokenMutation) ClearOpenaiBase() {
|
|
|
+ m.openai_base = nil
|
|
|
+ m.clearedFields[token.FieldOpenaiBase] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// OpenaiBaseCleared returns if the "openai_base" field was cleared in this mutation.
|
|
|
+func (m *TokenMutation) OpenaiBaseCleared() bool {
|
|
|
+ _, ok := m.clearedFields[token.FieldOpenaiBase]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOpenaiBase resets all changes to the "openai_base" field.
|
|
|
+func (m *TokenMutation) ResetOpenaiBase() {
|
|
|
+ m.openai_base = nil
|
|
|
+ delete(m.clearedFields, token.FieldOpenaiBase)
|
|
|
+}
|
|
|
+
|
|
|
+// SetOpenaiKey sets the "openai_key" field.
|
|
|
+func (m *TokenMutation) SetOpenaiKey(s string) {
|
|
|
+ m.openai_key = &s
|
|
|
+}
|
|
|
+
|
|
|
+// OpenaiKey returns the value of the "openai_key" field in the mutation.
|
|
|
+func (m *TokenMutation) OpenaiKey() (r string, exists bool) {
|
|
|
+ v := m.openai_key
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldOpenaiKey returns the old "openai_key" 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) OldOpenaiKey(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldOpenaiKey is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldOpenaiKey requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldOpenaiKey: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.OpenaiKey, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearOpenaiKey clears the value of the "openai_key" field.
|
|
|
+func (m *TokenMutation) ClearOpenaiKey() {
|
|
|
+ m.openai_key = nil
|
|
|
+ m.clearedFields[token.FieldOpenaiKey] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// OpenaiKeyCleared returns if the "openai_key" field was cleared in this mutation.
|
|
|
+func (m *TokenMutation) OpenaiKeyCleared() bool {
|
|
|
+ _, ok := m.clearedFields[token.FieldOpenaiKey]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOpenaiKey resets all changes to the "openai_key" field.
|
|
|
+func (m *TokenMutation) ResetOpenaiKey() {
|
|
|
+ m.openai_key = nil
|
|
|
+ delete(m.clearedFields, token.FieldOpenaiKey)
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the TokenMutation builder.
|
|
|
func (m *TokenMutation) Where(ps ...predicate.Token) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -22667,7 +22925,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, 7)
|
|
|
+ fields := make([]string, 0, 12)
|
|
|
if m.created_at != nil {
|
|
|
fields = append(fields, token.FieldCreatedAt)
|
|
|
}
|
|
@@ -22689,6 +22947,21 @@ func (m *TokenMutation) Fields() []string {
|
|
|
if m.organization_id != nil {
|
|
|
fields = append(fields, token.FieldOrganizationID)
|
|
|
}
|
|
|
+ if m.agent_id != nil {
|
|
|
+ fields = append(fields, token.FieldAgentID)
|
|
|
+ }
|
|
|
+ if m.custom_agent_base != nil {
|
|
|
+ fields = append(fields, token.FieldCustomAgentBase)
|
|
|
+ }
|
|
|
+ if m.custom_agent_key != nil {
|
|
|
+ fields = append(fields, token.FieldCustomAgentKey)
|
|
|
+ }
|
|
|
+ if m.openai_base != nil {
|
|
|
+ fields = append(fields, token.FieldOpenaiBase)
|
|
|
+ }
|
|
|
+ if m.openai_key != nil {
|
|
|
+ fields = append(fields, token.FieldOpenaiKey)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -22711,6 +22984,16 @@ func (m *TokenMutation) Field(name string) (ent.Value, bool) {
|
|
|
return m.MAC()
|
|
|
case token.FieldOrganizationID:
|
|
|
return m.OrganizationID()
|
|
|
+ case token.FieldAgentID:
|
|
|
+ return m.AgentID()
|
|
|
+ case token.FieldCustomAgentBase:
|
|
|
+ return m.CustomAgentBase()
|
|
|
+ case token.FieldCustomAgentKey:
|
|
|
+ return m.CustomAgentKey()
|
|
|
+ case token.FieldOpenaiBase:
|
|
|
+ return m.OpenaiBase()
|
|
|
+ case token.FieldOpenaiKey:
|
|
|
+ return m.OpenaiKey()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -22734,6 +23017,16 @@ func (m *TokenMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
|
|
return m.OldMAC(ctx)
|
|
|
case token.FieldOrganizationID:
|
|
|
return m.OldOrganizationID(ctx)
|
|
|
+ case token.FieldAgentID:
|
|
|
+ return m.OldAgentID(ctx)
|
|
|
+ case token.FieldCustomAgentBase:
|
|
|
+ return m.OldCustomAgentBase(ctx)
|
|
|
+ case token.FieldCustomAgentKey:
|
|
|
+ return m.OldCustomAgentKey(ctx)
|
|
|
+ case token.FieldOpenaiBase:
|
|
|
+ return m.OldOpenaiBase(ctx)
|
|
|
+ case token.FieldOpenaiKey:
|
|
|
+ return m.OldOpenaiKey(ctx)
|
|
|
}
|
|
|
return nil, fmt.Errorf("unknown Token field %s", name)
|
|
|
}
|
|
@@ -22792,6 +23085,41 @@ func (m *TokenMutation) SetField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.SetOrganizationID(v)
|
|
|
return nil
|
|
|
+ case token.FieldAgentID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAgentID(v)
|
|
|
+ return nil
|
|
|
+ case token.FieldCustomAgentBase:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetCustomAgentBase(v)
|
|
|
+ return nil
|
|
|
+ case token.FieldCustomAgentKey:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetCustomAgentKey(v)
|
|
|
+ return nil
|
|
|
+ case token.FieldOpenaiBase:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOpenaiBase(v)
|
|
|
+ return nil
|
|
|
+ case token.FieldOpenaiKey:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOpenaiKey(v)
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Token field %s", name)
|
|
|
}
|
|
@@ -22803,6 +23131,9 @@ func (m *TokenMutation) AddedFields() []string {
|
|
|
if m.addorganization_id != nil {
|
|
|
fields = append(fields, token.FieldOrganizationID)
|
|
|
}
|
|
|
+ if m.addagent_id != nil {
|
|
|
+ fields = append(fields, token.FieldAgentID)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -22813,6 +23144,8 @@ func (m *TokenMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
switch name {
|
|
|
case token.FieldOrganizationID:
|
|
|
return m.AddedOrganizationID()
|
|
|
+ case token.FieldAgentID:
|
|
|
+ return m.AddedAgentID()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -22829,6 +23162,13 @@ func (m *TokenMutation) AddField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.AddOrganizationID(v)
|
|
|
return nil
|
|
|
+ case token.FieldAgentID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAgentID(v)
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Token numeric field %s", name)
|
|
|
}
|
|
@@ -22846,6 +23186,18 @@ func (m *TokenMutation) ClearedFields() []string {
|
|
|
if m.FieldCleared(token.FieldToken) {
|
|
|
fields = append(fields, token.FieldToken)
|
|
|
}
|
|
|
+ if m.FieldCleared(token.FieldCustomAgentBase) {
|
|
|
+ fields = append(fields, token.FieldCustomAgentBase)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(token.FieldCustomAgentKey) {
|
|
|
+ fields = append(fields, token.FieldCustomAgentKey)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(token.FieldOpenaiBase) {
|
|
|
+ fields = append(fields, token.FieldOpenaiBase)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(token.FieldOpenaiKey) {
|
|
|
+ fields = append(fields, token.FieldOpenaiKey)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -22869,6 +23221,18 @@ func (m *TokenMutation) ClearField(name string) error {
|
|
|
case token.FieldToken:
|
|
|
m.ClearToken()
|
|
|
return nil
|
|
|
+ case token.FieldCustomAgentBase:
|
|
|
+ m.ClearCustomAgentBase()
|
|
|
+ return nil
|
|
|
+ case token.FieldCustomAgentKey:
|
|
|
+ m.ClearCustomAgentKey()
|
|
|
+ return nil
|
|
|
+ case token.FieldOpenaiBase:
|
|
|
+ m.ClearOpenaiBase()
|
|
|
+ return nil
|
|
|
+ case token.FieldOpenaiKey:
|
|
|
+ m.ClearOpenaiKey()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Token nullable field %s", name)
|
|
|
}
|
|
@@ -22898,6 +23262,21 @@ func (m *TokenMutation) ResetField(name string) error {
|
|
|
case token.FieldOrganizationID:
|
|
|
m.ResetOrganizationID()
|
|
|
return nil
|
|
|
+ case token.FieldAgentID:
|
|
|
+ m.ResetAgentID()
|
|
|
+ return nil
|
|
|
+ case token.FieldCustomAgentBase:
|
|
|
+ m.ResetCustomAgentBase()
|
|
|
+ return nil
|
|
|
+ case token.FieldCustomAgentKey:
|
|
|
+ m.ResetCustomAgentKey()
|
|
|
+ return nil
|
|
|
+ case token.FieldOpenaiBase:
|
|
|
+ m.ResetOpenaiBase()
|
|
|
+ return nil
|
|
|
+ case token.FieldOpenaiKey:
|
|
|
+ m.ResetOpenaiKey()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Token field %s", name)
|
|
|
}
|