|
@@ -81,6 +81,8 @@ type AgentMutation struct {
|
|
examples *string
|
|
examples *string
|
|
organization_id *uint64
|
|
organization_id *uint64
|
|
addorganization_id *int64
|
|
addorganization_id *int64
|
|
|
|
+ dataset_id *string
|
|
|
|
+ collection_id *string
|
|
clearedFields map[string]struct{}
|
|
clearedFields map[string]struct{}
|
|
wx_agent map[uint64]struct{}
|
|
wx_agent map[uint64]struct{}
|
|
removedwx_agent map[uint64]struct{}
|
|
removedwx_agent map[uint64]struct{}
|
|
@@ -611,6 +613,78 @@ func (m *AgentMutation) ResetOrganizationID() {
|
|
m.addorganization_id = nil
|
|
m.addorganization_id = nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// SetDatasetID sets the "dataset_id" field.
|
|
|
|
+func (m *AgentMutation) SetDatasetID(s string) {
|
|
|
|
+ m.dataset_id = &s
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// DatasetID returns the value of the "dataset_id" field in the mutation.
|
|
|
|
+func (m *AgentMutation) DatasetID() (r string, exists bool) {
|
|
|
|
+ v := m.dataset_id
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// OldDatasetID returns the old "dataset_id" field's value of the Agent entity.
|
|
|
|
+// If the Agent 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 *AgentMutation) OldDatasetID(ctx context.Context) (v string, err error) {
|
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
|
+ return v, errors.New("OldDatasetID is only allowed on UpdateOne operations")
|
|
|
|
+ }
|
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
|
+ return v, errors.New("OldDatasetID requires an ID field in the mutation")
|
|
|
|
+ }
|
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return v, fmt.Errorf("querying old value for OldDatasetID: %w", err)
|
|
|
|
+ }
|
|
|
|
+ return oldValue.DatasetID, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// ResetDatasetID resets all changes to the "dataset_id" field.
|
|
|
|
+func (m *AgentMutation) ResetDatasetID() {
|
|
|
|
+ m.dataset_id = nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// SetCollectionID sets the "collection_id" field.
|
|
|
|
+func (m *AgentMutation) SetCollectionID(s string) {
|
|
|
|
+ m.collection_id = &s
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// CollectionID returns the value of the "collection_id" field in the mutation.
|
|
|
|
+func (m *AgentMutation) CollectionID() (r string, exists bool) {
|
|
|
|
+ v := m.collection_id
|
|
|
|
+ if v == nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ return *v, true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// OldCollectionID returns the old "collection_id" field's value of the Agent entity.
|
|
|
|
+// If the Agent 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 *AgentMutation) OldCollectionID(ctx context.Context) (v string, err error) {
|
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
|
+ return v, errors.New("OldCollectionID is only allowed on UpdateOne operations")
|
|
|
|
+ }
|
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
|
+ return v, errors.New("OldCollectionID requires an ID field in the mutation")
|
|
|
|
+ }
|
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return v, fmt.Errorf("querying old value for OldCollectionID: %w", err)
|
|
|
|
+ }
|
|
|
|
+ return oldValue.CollectionID, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// ResetCollectionID resets all changes to the "collection_id" field.
|
|
|
|
+func (m *AgentMutation) ResetCollectionID() {
|
|
|
|
+ m.collection_id = nil
|
|
|
|
+}
|
|
|
|
+
|
|
// AddWxAgentIDs adds the "wx_agent" edge to the Wx entity by ids.
|
|
// AddWxAgentIDs adds the "wx_agent" edge to the Wx entity by ids.
|
|
func (m *AgentMutation) AddWxAgentIDs(ids ...uint64) {
|
|
func (m *AgentMutation) AddWxAgentIDs(ids ...uint64) {
|
|
if m.wx_agent == nil {
|
|
if m.wx_agent == nil {
|
|
@@ -699,7 +773,7 @@ func (m *AgentMutation) Type() string {
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
// AddedFields().
|
|
// AddedFields().
|
|
func (m *AgentMutation) Fields() []string {
|
|
func (m *AgentMutation) Fields() []string {
|
|
- fields := make([]string, 0, 9)
|
|
|
|
|
|
+ fields := make([]string, 0, 11)
|
|
if m.created_at != nil {
|
|
if m.created_at != nil {
|
|
fields = append(fields, agent.FieldCreatedAt)
|
|
fields = append(fields, agent.FieldCreatedAt)
|
|
}
|
|
}
|
|
@@ -727,6 +801,12 @@ func (m *AgentMutation) Fields() []string {
|
|
if m.organization_id != nil {
|
|
if m.organization_id != nil {
|
|
fields = append(fields, agent.FieldOrganizationID)
|
|
fields = append(fields, agent.FieldOrganizationID)
|
|
}
|
|
}
|
|
|
|
+ if m.dataset_id != nil {
|
|
|
|
+ fields = append(fields, agent.FieldDatasetID)
|
|
|
|
+ }
|
|
|
|
+ if m.collection_id != nil {
|
|
|
|
+ fields = append(fields, agent.FieldCollectionID)
|
|
|
|
+ }
|
|
return fields
|
|
return fields
|
|
}
|
|
}
|
|
|
|
|
|
@@ -753,6 +833,10 @@ func (m *AgentMutation) Field(name string) (ent.Value, bool) {
|
|
return m.Examples()
|
|
return m.Examples()
|
|
case agent.FieldOrganizationID:
|
|
case agent.FieldOrganizationID:
|
|
return m.OrganizationID()
|
|
return m.OrganizationID()
|
|
|
|
+ case agent.FieldDatasetID:
|
|
|
|
+ return m.DatasetID()
|
|
|
|
+ case agent.FieldCollectionID:
|
|
|
|
+ return m.CollectionID()
|
|
}
|
|
}
|
|
return nil, false
|
|
return nil, false
|
|
}
|
|
}
|
|
@@ -780,6 +864,10 @@ func (m *AgentMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
|
return m.OldExamples(ctx)
|
|
return m.OldExamples(ctx)
|
|
case agent.FieldOrganizationID:
|
|
case agent.FieldOrganizationID:
|
|
return m.OldOrganizationID(ctx)
|
|
return m.OldOrganizationID(ctx)
|
|
|
|
+ case agent.FieldDatasetID:
|
|
|
|
+ return m.OldDatasetID(ctx)
|
|
|
|
+ case agent.FieldCollectionID:
|
|
|
|
+ return m.OldCollectionID(ctx)
|
|
}
|
|
}
|
|
return nil, fmt.Errorf("unknown Agent field %s", name)
|
|
return nil, fmt.Errorf("unknown Agent field %s", name)
|
|
}
|
|
}
|
|
@@ -852,6 +940,20 @@ func (m *AgentMutation) SetField(name string, value ent.Value) error {
|
|
}
|
|
}
|
|
m.SetOrganizationID(v)
|
|
m.SetOrganizationID(v)
|
|
return nil
|
|
return nil
|
|
|
|
+ case agent.FieldDatasetID:
|
|
|
|
+ v, ok := value.(string)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.SetDatasetID(v)
|
|
|
|
+ return nil
|
|
|
|
+ case agent.FieldCollectionID:
|
|
|
|
+ v, ok := value.(string)
|
|
|
|
+ if !ok {
|
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
|
+ }
|
|
|
|
+ m.SetCollectionID(v)
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("unknown Agent field %s", name)
|
|
return fmt.Errorf("unknown Agent field %s", name)
|
|
}
|
|
}
|
|
@@ -982,6 +1084,12 @@ func (m *AgentMutation) ResetField(name string) error {
|
|
case agent.FieldOrganizationID:
|
|
case agent.FieldOrganizationID:
|
|
m.ResetOrganizationID()
|
|
m.ResetOrganizationID()
|
|
return nil
|
|
return nil
|
|
|
|
+ case agent.FieldDatasetID:
|
|
|
|
+ m.ResetDatasetID()
|
|
|
|
+ return nil
|
|
|
|
+ case agent.FieldCollectionID:
|
|
|
|
+ m.ResetCollectionID()
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("unknown Agent field %s", name)
|
|
return fmt.Errorf("unknown Agent field %s", name)
|
|
}
|
|
}
|