|
@@ -70,6 +70,9 @@ type AgentMutation struct {
|
|
|
organization_id *uint64
|
|
|
addorganization_id *int64
|
|
|
clearedFields map[string]struct{}
|
|
|
+ wx_agent map[uint64]struct{}
|
|
|
+ removedwx_agent map[uint64]struct{}
|
|
|
+ clearedwx_agent bool
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Agent, error)
|
|
|
predicates []predicate.Agent
|
|
@@ -570,6 +573,60 @@ func (m *AgentMutation) ResetOrganizationID() {
|
|
|
m.addorganization_id = nil
|
|
|
}
|
|
|
|
|
|
+// AddWxAgentIDs adds the "wx_agent" edge to the Wx entity by ids.
|
|
|
+func (m *AgentMutation) AddWxAgentIDs(ids ...uint64) {
|
|
|
+ if m.wx_agent == nil {
|
|
|
+ m.wx_agent = make(map[uint64]struct{})
|
|
|
+ }
|
|
|
+ for i := range ids {
|
|
|
+ m.wx_agent[ids[i]] = struct{}{}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// ClearWxAgent clears the "wx_agent" edge to the Wx entity.
|
|
|
+func (m *AgentMutation) ClearWxAgent() {
|
|
|
+ m.clearedwx_agent = true
|
|
|
+}
|
|
|
+
|
|
|
+// WxAgentCleared reports if the "wx_agent" edge to the Wx entity was cleared.
|
|
|
+func (m *AgentMutation) WxAgentCleared() bool {
|
|
|
+ return m.clearedwx_agent
|
|
|
+}
|
|
|
+
|
|
|
+// RemoveWxAgentIDs removes the "wx_agent" edge to the Wx entity by IDs.
|
|
|
+func (m *AgentMutation) RemoveWxAgentIDs(ids ...uint64) {
|
|
|
+ if m.removedwx_agent == nil {
|
|
|
+ m.removedwx_agent = make(map[uint64]struct{})
|
|
|
+ }
|
|
|
+ for i := range ids {
|
|
|
+ delete(m.wx_agent, ids[i])
|
|
|
+ m.removedwx_agent[ids[i]] = struct{}{}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedWxAgent returns the removed IDs of the "wx_agent" edge to the Wx entity.
|
|
|
+func (m *AgentMutation) RemovedWxAgentIDs() (ids []uint64) {
|
|
|
+ for id := range m.removedwx_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// WxAgentIDs returns the "wx_agent" edge IDs in the mutation.
|
|
|
+func (m *AgentMutation) WxAgentIDs() (ids []uint64) {
|
|
|
+ for id := range m.wx_agent {
|
|
|
+ ids = append(ids, id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ResetWxAgent resets all changes to the "wx_agent" edge.
|
|
|
+func (m *AgentMutation) ResetWxAgent() {
|
|
|
+ m.wx_agent = nil
|
|
|
+ m.clearedwx_agent = false
|
|
|
+ m.removedwx_agent = nil
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the AgentMutation builder.
|
|
|
func (m *AgentMutation) Where(ps ...predicate.Agent) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -881,49 +938,85 @@ 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, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.wx_agent != nil {
|
|
|
+ edges = append(edges, agent.EdgeWxAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
|
// name in this mutation.
|
|
|
func (m *AgentMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ switch name {
|
|
|
+ case agent.EdgeWxAgent:
|
|
|
+ ids := make([]ent.Value, 0, len(m.wx_agent))
|
|
|
+ for id := range m.wx_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, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.removedwx_agent != nil {
|
|
|
+ edges = append(edges, agent.EdgeWxAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
|
// the given name in this mutation.
|
|
|
func (m *AgentMutation) RemovedIDs(name string) []ent.Value {
|
|
|
+ switch name {
|
|
|
+ case agent.EdgeWxAgent:
|
|
|
+ ids := make([]ent.Value, 0, len(m.removedwx_agent))
|
|
|
+ for id := range m.removedwx_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, 0)
|
|
|
+ edges := make([]string, 0, 1)
|
|
|
+ if m.clearedwx_agent {
|
|
|
+ edges = append(edges, agent.EdgeWxAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
|
// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
|
// was cleared in this mutation.
|
|
|
func (m *AgentMutation) EdgeCleared(name string) bool {
|
|
|
+ switch name {
|
|
|
+ case agent.EdgeWxAgent:
|
|
|
+ return m.clearedwx_agent
|
|
|
+ }
|
|
|
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 *AgentMutation) ClearEdge(name string) error {
|
|
|
+ switch name {
|
|
|
+ }
|
|
|
return fmt.Errorf("unknown Agent 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 *AgentMutation) ResetEdge(name string) error {
|
|
|
+ switch name {
|
|
|
+ case agent.EdgeWxAgent:
|
|
|
+ m.ResetWxAgent()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
return fmt.Errorf("unknown Agent edge %s", name)
|
|
|
}
|
|
|
|
|
@@ -14163,6 +14256,8 @@ type WxMutation struct {
|
|
|
clearedFields map[string]struct{}
|
|
|
server *uint64
|
|
|
clearedserver bool
|
|
|
+ agent *uint64
|
|
|
+ clearedagent bool
|
|
|
done bool
|
|
|
oldValue func(context.Context) (*Wx, error)
|
|
|
predicates []predicate.Wx
|
|
@@ -14870,6 +14965,42 @@ func (m *WxMutation) ResetOrganizationID() {
|
|
|
delete(m.clearedFields, wx.FieldOrganizationID)
|
|
|
}
|
|
|
|
|
|
+// SetAgentID sets the "agent_id" field.
|
|
|
+func (m *WxMutation) SetAgentID(u uint64) {
|
|
|
+ m.agent = &u
|
|
|
+}
|
|
|
+
|
|
|
+// AgentID returns the value of the "agent_id" field in the mutation.
|
|
|
+func (m *WxMutation) AgentID() (r uint64, exists bool) {
|
|
|
+ v := m.agent
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAgentID returns the old "agent_id" field's value of the Wx entity.
|
|
|
+// If the Wx 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 *WxMutation) 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
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAgentID resets all changes to the "agent_id" field.
|
|
|
+func (m *WxMutation) ResetAgentID() {
|
|
|
+ m.agent = nil
|
|
|
+}
|
|
|
+
|
|
|
// ClearServer clears the "server" edge to the Server entity.
|
|
|
func (m *WxMutation) ClearServer() {
|
|
|
m.clearedserver = true
|
|
@@ -14897,6 +15028,33 @@ func (m *WxMutation) ResetServer() {
|
|
|
m.clearedserver = false
|
|
|
}
|
|
|
|
|
|
+// ClearAgent clears the "agent" edge to the Agent entity.
|
|
|
+func (m *WxMutation) ClearAgent() {
|
|
|
+ m.clearedagent = true
|
|
|
+ m.clearedFields[wx.FieldAgentID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// AgentCleared reports if the "agent" edge to the Agent entity was cleared.
|
|
|
+func (m *WxMutation) 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 *WxMutation) AgentIDs() (ids []uint64) {
|
|
|
+ if id := m.agent; id != nil {
|
|
|
+ ids = append(ids, *id)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAgent resets all changes to the "agent" edge.
|
|
|
+func (m *WxMutation) ResetAgent() {
|
|
|
+ m.agent = nil
|
|
|
+ m.clearedagent = false
|
|
|
+}
|
|
|
+
|
|
|
// Where appends a list predicates to the WxMutation builder.
|
|
|
func (m *WxMutation) Where(ps ...predicate.Wx) {
|
|
|
m.predicates = append(m.predicates, ps...)
|
|
@@ -14931,7 +15089,7 @@ func (m *WxMutation) Type() string {
|
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
|
// AddedFields().
|
|
|
func (m *WxMutation) Fields() []string {
|
|
|
- fields := make([]string, 0, 14)
|
|
|
+ fields := make([]string, 0, 15)
|
|
|
if m.created_at != nil {
|
|
|
fields = append(fields, wx.FieldCreatedAt)
|
|
|
}
|
|
@@ -14974,6 +15132,9 @@ func (m *WxMutation) Fields() []string {
|
|
|
if m.organization_id != nil {
|
|
|
fields = append(fields, wx.FieldOrganizationID)
|
|
|
}
|
|
|
+ if m.agent != nil {
|
|
|
+ fields = append(fields, wx.FieldAgentID)
|
|
|
+ }
|
|
|
return fields
|
|
|
}
|
|
|
|
|
@@ -15010,6 +15171,8 @@ func (m *WxMutation) Field(name string) (ent.Value, bool) {
|
|
|
return m.HeadBig()
|
|
|
case wx.FieldOrganizationID:
|
|
|
return m.OrganizationID()
|
|
|
+ case wx.FieldAgentID:
|
|
|
+ return m.AgentID()
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
@@ -15047,6 +15210,8 @@ func (m *WxMutation) OldField(ctx context.Context, name string) (ent.Value, erro
|
|
|
return m.OldHeadBig(ctx)
|
|
|
case wx.FieldOrganizationID:
|
|
|
return m.OldOrganizationID(ctx)
|
|
|
+ case wx.FieldAgentID:
|
|
|
+ return m.OldAgentID(ctx)
|
|
|
}
|
|
|
return nil, fmt.Errorf("unknown Wx field %s", name)
|
|
|
}
|
|
@@ -15154,6 +15319,13 @@ func (m *WxMutation) SetField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.SetOrganizationID(v)
|
|
|
return nil
|
|
|
+ case wx.FieldAgentID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAgentID(v)
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Wx field %s", name)
|
|
|
}
|
|
@@ -15299,16 +15471,22 @@ func (m *WxMutation) ResetField(name string) error {
|
|
|
case wx.FieldOrganizationID:
|
|
|
m.ResetOrganizationID()
|
|
|
return nil
|
|
|
+ case wx.FieldAgentID:
|
|
|
+ m.ResetAgentID()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Wx field %s", name)
|
|
|
}
|
|
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
func (m *WxMutation) AddedEdges() []string {
|
|
|
- edges := make([]string, 0, 1)
|
|
|
+ edges := make([]string, 0, 2)
|
|
|
if m.server != nil {
|
|
|
edges = append(edges, wx.EdgeServer)
|
|
|
}
|
|
|
+ if m.agent != nil {
|
|
|
+ edges = append(edges, wx.EdgeAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -15320,13 +15498,17 @@ func (m *WxMutation) AddedIDs(name string) []ent.Value {
|
|
|
if id := m.server; id != nil {
|
|
|
return []ent.Value{*id}
|
|
|
}
|
|
|
+ case wx.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 *WxMutation) RemovedEdges() []string {
|
|
|
- edges := make([]string, 0, 1)
|
|
|
+ edges := make([]string, 0, 2)
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -15338,10 +15520,13 @@ func (m *WxMutation) RemovedIDs(name string) []ent.Value {
|
|
|
|
|
|
// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
func (m *WxMutation) ClearedEdges() []string {
|
|
|
- edges := make([]string, 0, 1)
|
|
|
+ edges := make([]string, 0, 2)
|
|
|
if m.clearedserver {
|
|
|
edges = append(edges, wx.EdgeServer)
|
|
|
}
|
|
|
+ if m.clearedagent {
|
|
|
+ edges = append(edges, wx.EdgeAgent)
|
|
|
+ }
|
|
|
return edges
|
|
|
}
|
|
|
|
|
@@ -15351,6 +15536,8 @@ func (m *WxMutation) EdgeCleared(name string) bool {
|
|
|
switch name {
|
|
|
case wx.EdgeServer:
|
|
|
return m.clearedserver
|
|
|
+ case wx.EdgeAgent:
|
|
|
+ return m.clearedagent
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
@@ -15362,6 +15549,9 @@ func (m *WxMutation) ClearEdge(name string) error {
|
|
|
case wx.EdgeServer:
|
|
|
m.ClearServer()
|
|
|
return nil
|
|
|
+ case wx.EdgeAgent:
|
|
|
+ m.ClearAgent()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Wx unique edge %s", name)
|
|
|
}
|
|
@@ -15373,6 +15563,9 @@ func (m *WxMutation) ResetEdge(name string) error {
|
|
|
case wx.EdgeServer:
|
|
|
m.ResetServer()
|
|
|
return nil
|
|
|
+ case wx.EdgeAgent:
|
|
|
+ m.ResetAgent()
|
|
|
+ return nil
|
|
|
}
|
|
|
return fmt.Errorf("unknown Wx edge %s", name)
|
|
|
}
|