|
@@ -101,6 +101,9 @@ type AgentMutation struct {
|
|
|
wx_agent map[uint64]struct{}
|
|
|
removedwx_agent map[uint64]struct{}
|
|
|
clearedwx_agent bool
|
|
|
+ token_agent map[uint64]struct{}
|
|
|
+ removedtoken_agent map[uint64]struct{}
|
|
|
+ clearedtoken_agent bool
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Agent, error)
|
|
|
predicates []predicate.Agent
|
|
@@ -753,6 +756,60 @@ func (m *AgentMutation) ResetWxAgent() {
|
|
|
m.removedwx_agent = nil
|
|
|
}
|
|
|
|
|
|
+// AddTokenAgentIDs adds the "token_agent" edge to the Token entity by ids.
|
|
|
+func (m *AgentMutation) AddTokenAgentIDs(ids ...uint64) {
|
|
|
+ if m.token_agent == nil {
|
|
|
+ m.token_agent = make(map[uint64]struct{})
|
|
|
+ }
|
|
|
+ for i := range ids {
|
|
|
+ m.token_agent[ids[i]] = struct{}{}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// ClearTokenAgent clears the "token_agent" edge to the Token entity.
|
|
|
+func (m *AgentMutation) ClearTokenAgent() {
|
|
|
+ m.clearedtoken_agent = true
|
|
|
+}
|
|
|
+
|
|
|
+// TokenAgentCleared reports if the "token_agent" edge to the Token entity was cleared.
|
|
|
+func (m *AgentMutation) TokenAgentCleared() bool {
|
|
|
+ return m.clearedtoken_agent
|
|
|
+}
|
|
|
+
|
|
|
+// RemoveTokenAgentIDs removes the "token_agent" edge to the Token entity by IDs.
|
|
|
+func (m *AgentMutation) RemoveTokenAgentIDs(ids ...uint64) {
|
|
|
+ if m.removedtoken_agent == nil {
|
|
|
+ m.removedtoken_agent = make(map[uint64]struct{})
|
|
|
+ }
|
|
|
+ for i := range ids {
|
|
|
+ delete(m.token_agent, ids[i])
|
|
|
+ m.removedtoken_agent[ids[i]] = struct{}{}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedTokenAgent returns the removed IDs of the "token_agent" edge to the Token entity.
|
|
|
+func (m *AgentMutation) RemovedTokenAgentIDs() (ids []uint64) {
|
|
|
+ for id := range m.removedtoken_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// TokenAgentIDs returns the "token_agent" edge IDs in the mutation.
|
|
|
+func (m *AgentMutation) TokenAgentIDs() (ids []uint64) {
|
|
|
+ for id := range m.token_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTokenAgent resets all changes to the "token_agent" edge.
|
|
|
+func (m *AgentMutation) ResetTokenAgent() {
|
|
|
+ m.token_agent = nil
|
|
|
+ m.clearedtoken_agent = false
|
|
|
+ m.removedtoken_agent = nil
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the AgentMutation builder.
|
|
|
func (m *AgentMutation) Where(ps ...predicate.Agent) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -1110,10 +1167,13 @@ func (m *AgentMutation) ResetField(name string) error {
|
|
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
func (m *AgentMutation) AddedEdges() []string {
|
|
|
- edges := make([]string, 0, 1)
|
|
|
+ edges := make([]string, 0, 2)
|
|
|
if m.wx_agent != nil {
|
|
|
edges = append(edges, agent.EdgeWxAgent)
|
|
|
}
|
|
|
+ if m.token_agent != nil {
|
|
|
+ edges = append(edges, agent.EdgeTokenAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -1127,16 +1187,25 @@ func (m *AgentMutation) AddedIDs(name string) []ent.Value {
|
|
|
ids = append(ids, id)
|
|
|
}
|
|
|
return ids
|
|
|
+ case agent.EdgeTokenAgent:
|
|
|
+ ids := make([]ent.Value, 0, len(m.token_agent))
|
|
|
+ for id := range m.token_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return ids
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
func (m *AgentMutation) RemovedEdges() []string {
|
|
|
- edges := make([]string, 0, 1)
|
|
|
+ edges := make([]string, 0, 2)
|
|
|
if m.removedwx_agent != nil {
|
|
|
edges = append(edges, agent.EdgeWxAgent)
|
|
|
}
|
|
|
+ if m.removedtoken_agent != nil {
|
|
|
+ edges = append(edges, agent.EdgeTokenAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -1150,16 +1219,25 @@ func (m *AgentMutation) RemovedIDs(name string) []ent.Value {
|
|
|
ids = append(ids, id)
|
|
|
}
|
|
|
return ids
|
|
|
+ case agent.EdgeTokenAgent:
|
|
|
+ ids := make([]ent.Value, 0, len(m.removedtoken_agent))
|
|
|
+ for id := range m.removedtoken_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return ids
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
func (m *AgentMutation) ClearedEdges() []string {
|
|
|
- edges := make([]string, 0, 1)
|
|
|
+ edges := make([]string, 0, 2)
|
|
|
if m.clearedwx_agent {
|
|
|
edges = append(edges, agent.EdgeWxAgent)
|
|
|
}
|
|
|
+ if m.clearedtoken_agent {
|
|
|
+ edges = append(edges, agent.EdgeTokenAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -1169,6 +1247,8 @@ func (m *AgentMutation) EdgeCleared(name string) bool {
|
|
|
switch name {
|
|
|
case agent.EdgeWxAgent:
|
|
|
return m.clearedwx_agent
|
|
|
+ case agent.EdgeTokenAgent:
|
|
|
+ return m.clearedtoken_agent
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
@@ -1188,6 +1268,9 @@ func (m *AgentMutation) ResetEdge(name string) error {
|
|
|
case agent.EdgeWxAgent:
|
|
|
m.ResetWxAgent()
|
|
|
return nil
|
|
|
+ case agent.EdgeTokenAgent:
|
|
|
+ m.ResetTokenAgent()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Agent edge %s", name)
|
|
|
}
|
|
@@ -22212,13 +22295,13 @@ 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{}
|
|
|
+ agent *uint64
|
|
|
+ clearedagent bool
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Token, error)
|
|
|
predicates []predicate.Token
|
|
@@ -22578,9 +22661,22 @@ func (m *TokenMutation) OldMAC(ctx context.Context) (v string, err error) {
|
|
|
return oldValue.MAC, nil
|
|
|
}
|
|
|
|
|
|
+// ClearMAC clears the value of the "mac" field.
|
|
|
+func (m *TokenMutation) ClearMAC() {
|
|
|
+ m.mac = nil
|
|
|
+ m.clearedFields[token.FieldMAC] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// MACCleared returns if the "mac" field was cleared in this mutation.
|
|
|
+func (m *TokenMutation) MACCleared() bool {
|
|
|
+ _, ok := m.clearedFields[token.FieldMAC]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
// ResetMAC resets all changes to the "mac" field.
|
|
|
func (m *TokenMutation) ResetMAC() {
|
|
|
m.mac = nil
|
|
|
+ delete(m.clearedFields, token.FieldMAC)
|
|
|
}
|
|
|
|
|
|
// SetOrganizationID sets the "organization_id" field.
|
|
@@ -22641,13 +22737,12 @@ func (m *TokenMutation) ResetOrganizationID() {
|
|
|
|
|
|
// SetAgentID sets the "agent_id" field.
|
|
|
func (m *TokenMutation) SetAgentID(u uint64) {
|
|
|
- m.agent_id = &u
|
|
|
- m.addagent_id = nil
|
|
|
+ m.agent = &u
|
|
|
}
|
|
|
|
|
|
// AgentID returns the value of the "agent_id" field in the mutation.
|
|
|
func (m *TokenMutation) AgentID() (r uint64, exists bool) {
|
|
|
- v := m.agent_id
|
|
|
+ v := m.agent
|
|
|
if v == nil {
|
|
|
return
|
|
|
}
|
|
@@ -22671,28 +22766,9 @@ func (m *TokenMutation) OldAgentID(ctx context.Context) (v uint64, err error) {
|
|
|
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
|
|
|
+ m.agent = nil
|
|
|
}
|
|
|
|
|
|
// SetCustomAgentBase sets the "custom_agent_base" field.
|
|
@@ -22891,6 +22967,33 @@ func (m *TokenMutation) ResetOpenaiKey() {
|
|
|
delete(m.clearedFields, token.FieldOpenaiKey)
|
|
|
}
|
|
|
|
|
|
+// ClearAgent clears the "agent" edge to the Agent entity.
|
|
|
+func (m *TokenMutation) ClearAgent() {
|
|
|
+ m.clearedagent = true
|
|
|
+ m.clearedFields[token.FieldAgentID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// AgentCleared reports if the "agent" edge to the Agent entity was cleared.
|
|
|
+func (m *TokenMutation) AgentCleared() bool {
|
|
|
+ return m.clearedagent
|
|
|
+}
|
|
|
+
|
|
|
+// AgentIDs returns the "agent" edge IDs in the mutation.
|
|
|
+// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
|
|
+// AgentID instead. It exists only for internal usage by the builders.
|
|
|
+func (m *TokenMutation) AgentIDs() (ids []uint64) {
|
|
|
+ if id := m.agent; id != nil {
|
|
|
+ ids = append(ids, *id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAgent resets all changes to the "agent" edge.
|
|
|
+func (m *TokenMutation) ResetAgent() {
|
|
|
+ m.agent = nil
|
|
|
+ m.clearedagent = false
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the TokenMutation builder.
|
|
|
func (m *TokenMutation) Where(ps ...predicate.Token) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -22947,7 +23050,7 @@ func (m *TokenMutation) Fields() []string {
|
|
|
if m.organization_id != nil {
|
|
|
fields = append(fields, token.FieldOrganizationID)
|
|
|
}
|
|
|
- if m.agent_id != nil {
|
|
|
+ if m.agent != nil {
|
|
|
fields = append(fields, token.FieldAgentID)
|
|
|
}
|
|
|
if m.custom_agent_base != nil {
|
|
@@ -23131,9 +23234,6 @@ 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
|
|
|
}
|
|
|
|
|
@@ -23144,8 +23244,6 @@ 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
|
|
|
}
|
|
@@ -23162,13 +23260,6 @@ 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)
|
|
|
}
|
|
@@ -23186,6 +23277,9 @@ func (m *TokenMutation) ClearedFields() []string {
|
|
|
if m.FieldCleared(token.FieldToken) {
|
|
|
fields = append(fields, token.FieldToken)
|
|
|
}
|
|
|
+ if m.FieldCleared(token.FieldMAC) {
|
|
|
+ fields = append(fields, token.FieldMAC)
|
|
|
+ }
|
|
|
if m.FieldCleared(token.FieldCustomAgentBase) {
|
|
|
fields = append(fields, token.FieldCustomAgentBase)
|
|
|
}
|
|
@@ -23221,6 +23315,9 @@ func (m *TokenMutation) ClearField(name string) error {
|
|
|
case token.FieldToken:
|
|
|
m.ClearToken()
|
|
|
return nil
|
|
|
+ case token.FieldMAC:
|
|
|
+ m.ClearMAC()
|
|
|
+ return nil
|
|
|
case token.FieldCustomAgentBase:
|
|
|
m.ClearCustomAgentBase()
|
|
|
return nil
|
|
@@ -23283,19 +23380,28 @@ func (m *TokenMutation) ResetField(name string) error {
|
|
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
func (m *TokenMutation) AddedEdges() []string {
|
|
|
- edges := make([]string, 0, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.agent != nil {
|
|
|
+ edges = append(edges, token.EdgeAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
|
// name in this mutation.
|
|
|
func (m *TokenMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ switch name {
|
|
|
+ case token.EdgeAgent:
|
|
|
+ if id := m.agent; id != nil {
|
|
|
+ return []ent.Value{*id}
|
|
|
+ }
|
|
|
+ }
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
func (m *TokenMutation) RemovedEdges() []string {
|
|
|
- edges := make([]string, 0, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -23307,25 +23413,42 @@ func (m *TokenMutation) RemovedIDs(name string) []ent.Value {
|
|
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
func (m *TokenMutation) ClearedEdges() []string {
|
|
|
- edges := make([]string, 0, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.clearedagent {
|
|
|
+ edges = append(edges, token.EdgeAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
|
// was cleared in this mutation.
|
|
|
func (m *TokenMutation) EdgeCleared(name string) bool {
|
|
|
+ switch name {
|
|
|
+ case token.EdgeAgent:
|
|
|
+ return m.clearedagent
|
|
|
+ }
|
|
|
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 *TokenMutation) ClearEdge(name string) error {
|
|
|
+ switch name {
|
|
|
+ case token.EdgeAgent:
|
|
|
+ m.ClearAgent()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
return fmt.Errorf("unknown Token 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 *TokenMutation) ResetEdge(name string) error {
|
|
|
+ switch name {
|
|
|
+ case token.EdgeAgent:
|
|
|
+ m.ResetAgent()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
return fmt.Errorf("unknown Token edge %s", name)
|
|
|
}
|
|
|
|