2022-10-06 12:55:42 +00:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
2020-11-30 09:37:17 +00:00
|
|
|
|
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-03-17 13:12:13 +00:00
|
|
|
"errors"
|
2020-11-30 09:37:17 +00:00
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2021-03-15 17:46:52 +00:00
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
|
|
"entgo.io/ent/schema/field"
|
2020-11-30 09:37:17 +00:00
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/alert"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/decision"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/event"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/machine"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/meta"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/database/ent/predicate"
|
|
|
|
)
|
|
|
|
|
|
|
|
// AlertUpdate is the builder for updating Alert entities.
|
|
|
|
type AlertUpdate struct {
|
|
|
|
config
|
2021-01-14 15:27:45 +00:00
|
|
|
hooks []Hook
|
|
|
|
mutation *AlertMutation
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
|
2021-10-22 14:15:57 +00:00
|
|
|
// Where appends a list predicates to the AlertUpdate builder.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) Where(ps ...predicate.Alert) *AlertUpdate {
|
2021-10-22 14:15:57 +00:00
|
|
|
au.mutation.Where(ps...)
|
2020-11-30 09:37:17 +00:00
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetCreatedAt sets the "created_at" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetCreatedAt(t time.Time) *AlertUpdate {
|
|
|
|
au.mutation.SetCreatedAt(t)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2022-01-19 13:56:05 +00:00
|
|
|
// ClearCreatedAt clears the value of the "created_at" field.
|
|
|
|
func (au *AlertUpdate) ClearCreatedAt() *AlertUpdate {
|
|
|
|
au.mutation.ClearCreatedAt()
|
2020-11-30 09:37:17 +00:00
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetUpdatedAt(t time.Time) *AlertUpdate {
|
|
|
|
au.mutation.SetUpdatedAt(t)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2022-01-19 13:56:05 +00:00
|
|
|
// ClearUpdatedAt clears the value of the "updated_at" field.
|
|
|
|
func (au *AlertUpdate) ClearUpdatedAt() *AlertUpdate {
|
|
|
|
au.mutation.ClearUpdatedAt()
|
2020-11-30 09:37:17 +00:00
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetScenario sets the "scenario" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetScenario(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetScenario(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2024-03-07 13:25:25 +00:00
|
|
|
// SetNillableScenario sets the "scenario" field if the given value is not nil.
|
|
|
|
func (au *AlertUpdate) SetNillableScenario(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetScenario(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetBucketId sets the "bucketId" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetBucketId(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetBucketId(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableBucketId sets the "bucketId" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableBucketId(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetBucketId(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearBucketId clears the value of the "bucketId" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearBucketId() *AlertUpdate {
|
|
|
|
au.mutation.ClearBucketId()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetMessage sets the "message" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetMessage(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetMessage(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableMessage sets the "message" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableMessage(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetMessage(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearMessage clears the value of the "message" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearMessage() *AlertUpdate {
|
|
|
|
au.mutation.ClearMessage()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetEventsCount sets the "eventsCount" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetEventsCount(i int32) *AlertUpdate {
|
|
|
|
au.mutation.ResetEventsCount()
|
|
|
|
au.mutation.SetEventsCount(i)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableEventsCount sets the "eventsCount" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableEventsCount(i *int32) *AlertUpdate {
|
|
|
|
if i != nil {
|
|
|
|
au.SetEventsCount(*i)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddEventsCount adds i to the "eventsCount" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddEventsCount(i int32) *AlertUpdate {
|
|
|
|
au.mutation.AddEventsCount(i)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearEventsCount clears the value of the "eventsCount" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearEventsCount() *AlertUpdate {
|
|
|
|
au.mutation.ClearEventsCount()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetStartedAt sets the "startedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetStartedAt(t time.Time) *AlertUpdate {
|
|
|
|
au.mutation.SetStartedAt(t)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableStartedAt sets the "startedAt" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableStartedAt(t *time.Time) *AlertUpdate {
|
|
|
|
if t != nil {
|
|
|
|
au.SetStartedAt(*t)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearStartedAt clears the value of the "startedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearStartedAt() *AlertUpdate {
|
|
|
|
au.mutation.ClearStartedAt()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetStoppedAt sets the "stoppedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetStoppedAt(t time.Time) *AlertUpdate {
|
|
|
|
au.mutation.SetStoppedAt(t)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableStoppedAt sets the "stoppedAt" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableStoppedAt(t *time.Time) *AlertUpdate {
|
|
|
|
if t != nil {
|
|
|
|
au.SetStoppedAt(*t)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearStoppedAt clears the value of the "stoppedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearStoppedAt() *AlertUpdate {
|
|
|
|
au.mutation.ClearStoppedAt()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceIp sets the "sourceIp" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceIp(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceIp(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceIp sets the "sourceIp" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceIp(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceIp(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceIp clears the value of the "sourceIp" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceIp() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceIp()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceRange sets the "sourceRange" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceRange(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceRange(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceRange sets the "sourceRange" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceRange(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceRange(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceRange clears the value of the "sourceRange" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceRange() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceRange()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceAsNumber sets the "sourceAsNumber" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceAsNumber(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceAsNumber(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceAsNumber sets the "sourceAsNumber" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceAsNumber(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceAsNumber(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceAsNumber clears the value of the "sourceAsNumber" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceAsNumber() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceAsNumber()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceAsName sets the "sourceAsName" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceAsName(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceAsName(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceAsName sets the "sourceAsName" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceAsName(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceAsName(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceAsName clears the value of the "sourceAsName" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceAsName() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceAsName()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceCountry sets the "sourceCountry" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceCountry(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceCountry(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceCountry sets the "sourceCountry" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceCountry(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceCountry(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceCountry clears the value of the "sourceCountry" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceCountry() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceCountry()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceLatitude sets the "sourceLatitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceLatitude(f float32) *AlertUpdate {
|
|
|
|
au.mutation.ResetSourceLatitude()
|
|
|
|
au.mutation.SetSourceLatitude(f)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceLatitude sets the "sourceLatitude" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceLatitude(f *float32) *AlertUpdate {
|
|
|
|
if f != nil {
|
|
|
|
au.SetSourceLatitude(*f)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddSourceLatitude adds f to the "sourceLatitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddSourceLatitude(f float32) *AlertUpdate {
|
|
|
|
au.mutation.AddSourceLatitude(f)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceLatitude clears the value of the "sourceLatitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceLatitude() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceLatitude()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceLongitude sets the "sourceLongitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceLongitude(f float32) *AlertUpdate {
|
|
|
|
au.mutation.ResetSourceLongitude()
|
|
|
|
au.mutation.SetSourceLongitude(f)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceLongitude sets the "sourceLongitude" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceLongitude(f *float32) *AlertUpdate {
|
|
|
|
if f != nil {
|
|
|
|
au.SetSourceLongitude(*f)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddSourceLongitude adds f to the "sourceLongitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddSourceLongitude(f float32) *AlertUpdate {
|
|
|
|
au.mutation.AddSourceLongitude(f)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceLongitude clears the value of the "sourceLongitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceLongitude() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceLongitude()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceScope sets the "sourceScope" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceScope(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceScope(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceScope sets the "sourceScope" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceScope(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceScope(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceScope clears the value of the "sourceScope" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceScope() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceScope()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceValue sets the "sourceValue" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSourceValue(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetSourceValue(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceValue sets the "sourceValue" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSourceValue(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetSourceValue(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceValue clears the value of the "sourceValue" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearSourceValue() *AlertUpdate {
|
|
|
|
au.mutation.ClearSourceValue()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetCapacity sets the "capacity" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetCapacity(i int32) *AlertUpdate {
|
|
|
|
au.mutation.ResetCapacity()
|
|
|
|
au.mutation.SetCapacity(i)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableCapacity sets the "capacity" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableCapacity(i *int32) *AlertUpdate {
|
|
|
|
if i != nil {
|
|
|
|
au.SetCapacity(*i)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddCapacity adds i to the "capacity" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddCapacity(i int32) *AlertUpdate {
|
|
|
|
au.mutation.AddCapacity(i)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearCapacity clears the value of the "capacity" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearCapacity() *AlertUpdate {
|
|
|
|
au.mutation.ClearCapacity()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetLeakSpeed sets the "leakSpeed" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetLeakSpeed(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetLeakSpeed(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableLeakSpeed sets the "leakSpeed" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableLeakSpeed(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetLeakSpeed(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearLeakSpeed clears the value of the "leakSpeed" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearLeakSpeed() *AlertUpdate {
|
|
|
|
au.mutation.ClearLeakSpeed()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetScenarioVersion sets the "scenarioVersion" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetScenarioVersion(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetScenarioVersion(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableScenarioVersion sets the "scenarioVersion" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableScenarioVersion(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetScenarioVersion(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearScenarioVersion clears the value of the "scenarioVersion" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearScenarioVersion() *AlertUpdate {
|
|
|
|
au.mutation.ClearScenarioVersion()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetScenarioHash sets the "scenarioHash" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetScenarioHash(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetScenarioHash(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableScenarioHash sets the "scenarioHash" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableScenarioHash(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetScenarioHash(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearScenarioHash clears the value of the "scenarioHash" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearScenarioHash() *AlertUpdate {
|
|
|
|
au.mutation.ClearScenarioHash()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSimulated sets the "simulated" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetSimulated(b bool) *AlertUpdate {
|
|
|
|
au.mutation.SetSimulated(b)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSimulated sets the "simulated" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableSimulated(b *bool) *AlertUpdate {
|
|
|
|
if b != nil {
|
|
|
|
au.SetSimulated(*b)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2023-01-31 13:47:44 +00:00
|
|
|
// SetUUID sets the "uuid" field.
|
|
|
|
func (au *AlertUpdate) SetUUID(s string) *AlertUpdate {
|
|
|
|
au.mutation.SetUUID(s)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableUUID sets the "uuid" field if the given value is not nil.
|
|
|
|
func (au *AlertUpdate) SetNillableUUID(s *string) *AlertUpdate {
|
|
|
|
if s != nil {
|
|
|
|
au.SetUUID(*s)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearUUID clears the value of the "uuid" field.
|
|
|
|
func (au *AlertUpdate) ClearUUID() *AlertUpdate {
|
|
|
|
au.mutation.ClearUUID()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetOwnerID sets the "owner" edge to the Machine entity by ID.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetOwnerID(id int) *AlertUpdate {
|
|
|
|
au.mutation.SetOwnerID(id)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableOwnerID sets the "owner" edge to the Machine entity by ID if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetNillableOwnerID(id *int) *AlertUpdate {
|
|
|
|
if id != nil {
|
|
|
|
au = au.SetOwnerID(*id)
|
|
|
|
}
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetOwner sets the "owner" edge to the Machine entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) SetOwner(m *Machine) *AlertUpdate {
|
|
|
|
return au.SetOwnerID(m.ID)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddDecisionIDs adds the "decisions" edge to the Decision entity by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddDecisionIDs(ids ...int) *AlertUpdate {
|
|
|
|
au.mutation.AddDecisionIDs(ids...)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddDecisions adds the "decisions" edges to the Decision entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddDecisions(d ...*Decision) *AlertUpdate {
|
|
|
|
ids := make([]int, len(d))
|
|
|
|
for i := range d {
|
|
|
|
ids[i] = d[i].ID
|
|
|
|
}
|
|
|
|
return au.AddDecisionIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddEventIDs adds the "events" edge to the Event entity by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddEventIDs(ids ...int) *AlertUpdate {
|
|
|
|
au.mutation.AddEventIDs(ids...)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddEvents adds the "events" edges to the Event entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddEvents(e ...*Event) *AlertUpdate {
|
|
|
|
ids := make([]int, len(e))
|
|
|
|
for i := range e {
|
|
|
|
ids[i] = e[i].ID
|
|
|
|
}
|
|
|
|
return au.AddEventIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddMetaIDs adds the "metas" edge to the Meta entity by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddMetaIDs(ids ...int) *AlertUpdate {
|
|
|
|
au.mutation.AddMetaIDs(ids...)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddMetas adds the "metas" edges to the Meta entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) AddMetas(m ...*Meta) *AlertUpdate {
|
|
|
|
ids := make([]int, len(m))
|
|
|
|
for i := range m {
|
|
|
|
ids[i] = m[i].ID
|
|
|
|
}
|
|
|
|
return au.AddMetaIDs(ids...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mutation returns the AlertMutation object of the builder.
|
|
|
|
func (au *AlertUpdate) Mutation() *AlertMutation {
|
|
|
|
return au.mutation
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearOwner clears the "owner" edge to the Machine entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearOwner() *AlertUpdate {
|
|
|
|
au.mutation.ClearOwner()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearDecisions clears all "decisions" edges to the Decision entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearDecisions() *AlertUpdate {
|
|
|
|
au.mutation.ClearDecisions()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveDecisionIDs removes the "decisions" edge to Decision entities by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) RemoveDecisionIDs(ids ...int) *AlertUpdate {
|
|
|
|
au.mutation.RemoveDecisionIDs(ids...)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveDecisions removes "decisions" edges to Decision entities.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) RemoveDecisions(d ...*Decision) *AlertUpdate {
|
|
|
|
ids := make([]int, len(d))
|
|
|
|
for i := range d {
|
|
|
|
ids[i] = d[i].ID
|
|
|
|
}
|
|
|
|
return au.RemoveDecisionIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearEvents clears all "events" edges to the Event entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearEvents() *AlertUpdate {
|
|
|
|
au.mutation.ClearEvents()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveEventIDs removes the "events" edge to Event entities by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) RemoveEventIDs(ids ...int) *AlertUpdate {
|
|
|
|
au.mutation.RemoveEventIDs(ids...)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveEvents removes "events" edges to Event entities.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) RemoveEvents(e ...*Event) *AlertUpdate {
|
|
|
|
ids := make([]int, len(e))
|
|
|
|
for i := range e {
|
|
|
|
ids[i] = e[i].ID
|
|
|
|
}
|
|
|
|
return au.RemoveEventIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearMetas clears all "metas" edges to the Meta entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) ClearMetas() *AlertUpdate {
|
|
|
|
au.mutation.ClearMetas()
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveMetaIDs removes the "metas" edge to Meta entities by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) RemoveMetaIDs(ids ...int) *AlertUpdate {
|
|
|
|
au.mutation.RemoveMetaIDs(ids...)
|
|
|
|
return au
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveMetas removes "metas" edges to Meta entities.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) RemoveMetas(m ...*Meta) *AlertUpdate {
|
|
|
|
ids := make([]int, len(m))
|
|
|
|
for i := range m {
|
|
|
|
ids[i] = m[i].ID
|
|
|
|
}
|
|
|
|
return au.RemoveMetaIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) Save(ctx context.Context) (int, error) {
|
2022-01-19 13:56:05 +00:00
|
|
|
au.defaults()
|
2024-02-14 10:19:13 +00:00
|
|
|
return withHooks(ctx, au.sqlSave, au.mutation, au.hooks)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
|
|
func (au *AlertUpdate) SaveX(ctx context.Context) int {
|
|
|
|
affected, err := au.Save(ctx)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return affected
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exec executes the query.
|
|
|
|
func (au *AlertUpdate) Exec(ctx context.Context) error {
|
|
|
|
_, err := au.Save(ctx)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
|
|
func (au *AlertUpdate) ExecX(ctx context.Context) {
|
|
|
|
if err := au.Exec(ctx); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-19 13:56:05 +00:00
|
|
|
// defaults sets the default values of the builder before save.
|
|
|
|
func (au *AlertUpdate) defaults() {
|
|
|
|
if _, ok := au.mutation.CreatedAt(); !ok && !au.mutation.CreatedAtCleared() {
|
|
|
|
v := alert.UpdateDefaultCreatedAt()
|
|
|
|
au.mutation.SetCreatedAt(v)
|
|
|
|
}
|
|
|
|
if _, ok := au.mutation.UpdatedAt(); !ok && !au.mutation.UpdatedAtCleared() {
|
|
|
|
v := alert.UpdateDefaultUpdatedAt()
|
|
|
|
au.mutation.SetUpdatedAt(v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-30 09:37:17 +00:00
|
|
|
func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec := sqlgraph.NewUpdateSpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt))
|
2021-01-14 15:27:45 +00:00
|
|
|
if ps := au.mutation.predicates; len(ps) > 0 {
|
2020-11-30 09:37:17 +00:00
|
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
|
|
for i := range ps {
|
|
|
|
ps[i](selector)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if value, ok := au.mutation.CreatedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldCreatedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
2022-01-19 13:56:05 +00:00
|
|
|
if au.mutation.CreatedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldCreatedAt, field.TypeTime)
|
2022-01-19 13:56:05 +00:00
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if value, ok := au.mutation.UpdatedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
2022-01-19 13:56:05 +00:00
|
|
|
if au.mutation.UpdatedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldUpdatedAt, field.TypeTime)
|
2022-01-19 13:56:05 +00:00
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if value, ok := au.mutation.Scenario(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldScenario, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.BucketId(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldBucketId, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.BucketIdCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldBucketId, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.Message(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldMessage, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.MessageCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldMessage, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.EventsCount(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldEventsCount, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.AddedEventsCount(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldEventsCount, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.EventsCountCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldEventsCount, field.TypeInt32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.StartedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldStartedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.StartedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldStartedAt, field.TypeTime)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.StoppedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldStoppedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.StoppedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldStoppedAt, field.TypeTime)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceIp(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceIp, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceIpCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceIp, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceRange(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceRange, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceRangeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceRange, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceAsNumber(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceAsNumber, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceAsNumberCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceAsNumber, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceAsName(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceAsName, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceAsNameCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceAsName, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceCountry(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceCountry, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceCountryCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceCountry, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceLatitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceLatitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.AddedSourceLatitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldSourceLatitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceLatitudeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceLatitude, field.TypeFloat32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceLongitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceLongitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.AddedSourceLongitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldSourceLongitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceLongitudeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceLongitude, field.TypeFloat32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceScope(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceScope, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceScopeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceScope, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.SourceValue(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceValue, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.SourceValueCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceValue, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.Capacity(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldCapacity, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.AddedCapacity(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldCapacity, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.CapacityCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldCapacity, field.TypeInt32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.LeakSpeed(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldLeakSpeed, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.LeakSpeedCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldLeakSpeed, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.ScenarioVersion(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldScenarioVersion, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.ScenarioVersionCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldScenarioVersion, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.ScenarioHash(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldScenarioHash, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if au.mutation.ScenarioHashCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldScenarioHash, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := au.mutation.Simulated(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSimulated, field.TypeBool, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
2023-01-31 13:47:44 +00:00
|
|
|
if value, ok := au.mutation.UUID(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldUUID, field.TypeString, value)
|
2023-01-31 13:47:44 +00:00
|
|
|
}
|
|
|
|
if au.mutation.UUIDCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldUUID, field.TypeString)
|
2023-01-31 13:47:44 +00:00
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if au.mutation.OwnerCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: alert.OwnerTable,
|
|
|
|
Columns: []string{alert.OwnerColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.OwnerIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: alert.OwnerTable,
|
|
|
|
Columns: []string{alert.OwnerColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if au.mutation.DecisionsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.DecisionsTable,
|
|
|
|
Columns: []string{alert.DecisionsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.RemovedDecisionsIDs(); len(nodes) > 0 && !au.mutation.DecisionsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.DecisionsTable,
|
|
|
|
Columns: []string{alert.DecisionsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.DecisionsIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.DecisionsTable,
|
|
|
|
Columns: []string{alert.DecisionsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if au.mutation.EventsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.EventsTable,
|
|
|
|
Columns: []string{alert.EventsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.RemovedEventsIDs(); len(nodes) > 0 && !au.mutation.EventsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.EventsTable,
|
|
|
|
Columns: []string{alert.EventsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.EventsIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.EventsTable,
|
|
|
|
Columns: []string{alert.EventsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if au.mutation.MetasCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.MetasTable,
|
|
|
|
Columns: []string{alert.MetasColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.RemovedMetasIDs(); len(nodes) > 0 && !au.mutation.MetasCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.MetasTable,
|
|
|
|
Columns: []string{alert.MetasColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := au.mutation.MetasIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.MetasTable,
|
|
|
|
Columns: []string{alert.MetasColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if n, err = sqlgraph.UpdateNodes(ctx, au.driver, _spec); err != nil {
|
|
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
|
|
err = &NotFoundError{alert.Label}
|
2021-10-22 14:15:57 +00:00
|
|
|
} else if sqlgraph.IsConstraintError(err) {
|
2022-10-06 12:55:42 +00:00
|
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
return 0, err
|
|
|
|
}
|
2024-02-14 10:19:13 +00:00
|
|
|
au.mutation.done = true
|
2020-11-30 09:37:17 +00:00
|
|
|
return n, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// AlertUpdateOne is the builder for updating a single Alert entity.
|
|
|
|
type AlertUpdateOne struct {
|
|
|
|
config
|
2021-10-22 14:15:57 +00:00
|
|
|
fields []string
|
2020-11-30 09:37:17 +00:00
|
|
|
hooks []Hook
|
|
|
|
mutation *AlertMutation
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetCreatedAt sets the "created_at" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetCreatedAt(t time.Time) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetCreatedAt(t)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2022-01-19 13:56:05 +00:00
|
|
|
// ClearCreatedAt clears the value of the "created_at" field.
|
|
|
|
func (auo *AlertUpdateOne) ClearCreatedAt() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearCreatedAt()
|
2020-11-30 09:37:17 +00:00
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetUpdatedAt(t time.Time) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetUpdatedAt(t)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2022-01-19 13:56:05 +00:00
|
|
|
// ClearUpdatedAt clears the value of the "updated_at" field.
|
|
|
|
func (auo *AlertUpdateOne) ClearUpdatedAt() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearUpdatedAt()
|
2020-11-30 09:37:17 +00:00
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetScenario sets the "scenario" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetScenario(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetScenario(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2024-03-07 13:25:25 +00:00
|
|
|
// SetNillableScenario sets the "scenario" field if the given value is not nil.
|
|
|
|
func (auo *AlertUpdateOne) SetNillableScenario(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetScenario(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetBucketId sets the "bucketId" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetBucketId(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetBucketId(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableBucketId sets the "bucketId" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableBucketId(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetBucketId(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearBucketId clears the value of the "bucketId" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearBucketId() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearBucketId()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetMessage sets the "message" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetMessage(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetMessage(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableMessage sets the "message" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableMessage(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetMessage(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearMessage clears the value of the "message" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearMessage() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearMessage()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetEventsCount sets the "eventsCount" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetEventsCount(i int32) *AlertUpdateOne {
|
|
|
|
auo.mutation.ResetEventsCount()
|
|
|
|
auo.mutation.SetEventsCount(i)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableEventsCount sets the "eventsCount" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableEventsCount(i *int32) *AlertUpdateOne {
|
|
|
|
if i != nil {
|
|
|
|
auo.SetEventsCount(*i)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddEventsCount adds i to the "eventsCount" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddEventsCount(i int32) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddEventsCount(i)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearEventsCount clears the value of the "eventsCount" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearEventsCount() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearEventsCount()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetStartedAt sets the "startedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetStartedAt(t time.Time) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetStartedAt(t)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableStartedAt sets the "startedAt" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableStartedAt(t *time.Time) *AlertUpdateOne {
|
|
|
|
if t != nil {
|
|
|
|
auo.SetStartedAt(*t)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearStartedAt clears the value of the "startedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearStartedAt() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearStartedAt()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetStoppedAt sets the "stoppedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetStoppedAt(t time.Time) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetStoppedAt(t)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableStoppedAt sets the "stoppedAt" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableStoppedAt(t *time.Time) *AlertUpdateOne {
|
|
|
|
if t != nil {
|
|
|
|
auo.SetStoppedAt(*t)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearStoppedAt clears the value of the "stoppedAt" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearStoppedAt() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearStoppedAt()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceIp sets the "sourceIp" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceIp(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceIp(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceIp sets the "sourceIp" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceIp(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceIp(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceIp clears the value of the "sourceIp" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceIp() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceIp()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceRange sets the "sourceRange" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceRange(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceRange(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceRange sets the "sourceRange" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceRange(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceRange(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceRange clears the value of the "sourceRange" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceRange() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceRange()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceAsNumber sets the "sourceAsNumber" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceAsNumber(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceAsNumber(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceAsNumber sets the "sourceAsNumber" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceAsNumber(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceAsNumber(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceAsNumber clears the value of the "sourceAsNumber" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceAsNumber() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceAsNumber()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceAsName sets the "sourceAsName" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceAsName(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceAsName(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceAsName sets the "sourceAsName" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceAsName(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceAsName(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceAsName clears the value of the "sourceAsName" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceAsName() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceAsName()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceCountry sets the "sourceCountry" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceCountry(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceCountry(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceCountry sets the "sourceCountry" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceCountry(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceCountry(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceCountry clears the value of the "sourceCountry" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceCountry() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceCountry()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceLatitude sets the "sourceLatitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceLatitude(f float32) *AlertUpdateOne {
|
|
|
|
auo.mutation.ResetSourceLatitude()
|
|
|
|
auo.mutation.SetSourceLatitude(f)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceLatitude sets the "sourceLatitude" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceLatitude(f *float32) *AlertUpdateOne {
|
|
|
|
if f != nil {
|
|
|
|
auo.SetSourceLatitude(*f)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddSourceLatitude adds f to the "sourceLatitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddSourceLatitude(f float32) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddSourceLatitude(f)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceLatitude clears the value of the "sourceLatitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceLatitude() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceLatitude()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceLongitude sets the "sourceLongitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceLongitude(f float32) *AlertUpdateOne {
|
|
|
|
auo.mutation.ResetSourceLongitude()
|
|
|
|
auo.mutation.SetSourceLongitude(f)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceLongitude sets the "sourceLongitude" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceLongitude(f *float32) *AlertUpdateOne {
|
|
|
|
if f != nil {
|
|
|
|
auo.SetSourceLongitude(*f)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddSourceLongitude adds f to the "sourceLongitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddSourceLongitude(f float32) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddSourceLongitude(f)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceLongitude clears the value of the "sourceLongitude" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceLongitude() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceLongitude()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceScope sets the "sourceScope" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceScope(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceScope(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceScope sets the "sourceScope" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceScope(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceScope(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceScope clears the value of the "sourceScope" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceScope() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceScope()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSourceValue sets the "sourceValue" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSourceValue(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSourceValue(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSourceValue sets the "sourceValue" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSourceValue(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetSourceValue(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearSourceValue clears the value of the "sourceValue" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearSourceValue() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearSourceValue()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetCapacity sets the "capacity" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetCapacity(i int32) *AlertUpdateOne {
|
|
|
|
auo.mutation.ResetCapacity()
|
|
|
|
auo.mutation.SetCapacity(i)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableCapacity sets the "capacity" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableCapacity(i *int32) *AlertUpdateOne {
|
|
|
|
if i != nil {
|
|
|
|
auo.SetCapacity(*i)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddCapacity adds i to the "capacity" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddCapacity(i int32) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddCapacity(i)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearCapacity clears the value of the "capacity" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearCapacity() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearCapacity()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetLeakSpeed sets the "leakSpeed" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetLeakSpeed(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetLeakSpeed(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableLeakSpeed sets the "leakSpeed" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableLeakSpeed(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetLeakSpeed(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearLeakSpeed clears the value of the "leakSpeed" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearLeakSpeed() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearLeakSpeed()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetScenarioVersion sets the "scenarioVersion" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetScenarioVersion(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetScenarioVersion(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableScenarioVersion sets the "scenarioVersion" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableScenarioVersion(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetScenarioVersion(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearScenarioVersion clears the value of the "scenarioVersion" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearScenarioVersion() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearScenarioVersion()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetScenarioHash sets the "scenarioHash" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetScenarioHash(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetScenarioHash(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableScenarioHash sets the "scenarioHash" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableScenarioHash(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetScenarioHash(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearScenarioHash clears the value of the "scenarioHash" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearScenarioHash() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearScenarioHash()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetSimulated sets the "simulated" field.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetSimulated(b bool) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetSimulated(b)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableSimulated sets the "simulated" field if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableSimulated(b *bool) *AlertUpdateOne {
|
|
|
|
if b != nil {
|
|
|
|
auo.SetSimulated(*b)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2023-01-31 13:47:44 +00:00
|
|
|
// SetUUID sets the "uuid" field.
|
|
|
|
func (auo *AlertUpdateOne) SetUUID(s string) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetUUID(s)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableUUID sets the "uuid" field if the given value is not nil.
|
|
|
|
func (auo *AlertUpdateOne) SetNillableUUID(s *string) *AlertUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
auo.SetUUID(*s)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearUUID clears the value of the "uuid" field.
|
|
|
|
func (auo *AlertUpdateOne) ClearUUID() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearUUID()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetOwnerID sets the "owner" edge to the Machine entity by ID.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetOwnerID(id int) *AlertUpdateOne {
|
|
|
|
auo.mutation.SetOwnerID(id)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetNillableOwnerID sets the "owner" edge to the Machine entity by ID if the given value is not nil.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetNillableOwnerID(id *int) *AlertUpdateOne {
|
|
|
|
if id != nil {
|
|
|
|
auo = auo.SetOwnerID(*id)
|
|
|
|
}
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// SetOwner sets the "owner" edge to the Machine entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) SetOwner(m *Machine) *AlertUpdateOne {
|
|
|
|
return auo.SetOwnerID(m.ID)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddDecisionIDs adds the "decisions" edge to the Decision entity by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddDecisionIDs(ids ...int) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddDecisionIDs(ids...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddDecisions adds the "decisions" edges to the Decision entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddDecisions(d ...*Decision) *AlertUpdateOne {
|
|
|
|
ids := make([]int, len(d))
|
|
|
|
for i := range d {
|
|
|
|
ids[i] = d[i].ID
|
|
|
|
}
|
|
|
|
return auo.AddDecisionIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddEventIDs adds the "events" edge to the Event entity by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddEventIDs(ids ...int) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddEventIDs(ids...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddEvents adds the "events" edges to the Event entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddEvents(e ...*Event) *AlertUpdateOne {
|
|
|
|
ids := make([]int, len(e))
|
|
|
|
for i := range e {
|
|
|
|
ids[i] = e[i].ID
|
|
|
|
}
|
|
|
|
return auo.AddEventIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddMetaIDs adds the "metas" edge to the Meta entity by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddMetaIDs(ids ...int) *AlertUpdateOne {
|
|
|
|
auo.mutation.AddMetaIDs(ids...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// AddMetas adds the "metas" edges to the Meta entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) AddMetas(m ...*Meta) *AlertUpdateOne {
|
|
|
|
ids := make([]int, len(m))
|
|
|
|
for i := range m {
|
|
|
|
ids[i] = m[i].ID
|
|
|
|
}
|
|
|
|
return auo.AddMetaIDs(ids...)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mutation returns the AlertMutation object of the builder.
|
|
|
|
func (auo *AlertUpdateOne) Mutation() *AlertMutation {
|
|
|
|
return auo.mutation
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearOwner clears the "owner" edge to the Machine entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearOwner() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearOwner()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearDecisions clears all "decisions" edges to the Decision entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearDecisions() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearDecisions()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveDecisionIDs removes the "decisions" edge to Decision entities by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) RemoveDecisionIDs(ids ...int) *AlertUpdateOne {
|
|
|
|
auo.mutation.RemoveDecisionIDs(ids...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveDecisions removes "decisions" edges to Decision entities.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) RemoveDecisions(d ...*Decision) *AlertUpdateOne {
|
|
|
|
ids := make([]int, len(d))
|
|
|
|
for i := range d {
|
|
|
|
ids[i] = d[i].ID
|
|
|
|
}
|
|
|
|
return auo.RemoveDecisionIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearEvents clears all "events" edges to the Event entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearEvents() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearEvents()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveEventIDs removes the "events" edge to Event entities by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) RemoveEventIDs(ids ...int) *AlertUpdateOne {
|
|
|
|
auo.mutation.RemoveEventIDs(ids...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveEvents removes "events" edges to Event entities.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) RemoveEvents(e ...*Event) *AlertUpdateOne {
|
|
|
|
ids := make([]int, len(e))
|
|
|
|
for i := range e {
|
|
|
|
ids[i] = e[i].ID
|
|
|
|
}
|
|
|
|
return auo.RemoveEventIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// ClearMetas clears all "metas" edges to the Meta entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) ClearMetas() *AlertUpdateOne {
|
|
|
|
auo.mutation.ClearMetas()
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveMetaIDs removes the "metas" edge to Meta entities by IDs.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) RemoveMetaIDs(ids ...int) *AlertUpdateOne {
|
|
|
|
auo.mutation.RemoveMetaIDs(ids...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// RemoveMetas removes "metas" edges to Meta entities.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) RemoveMetas(m ...*Meta) *AlertUpdateOne {
|
|
|
|
ids := make([]int, len(m))
|
|
|
|
for i := range m {
|
|
|
|
ids[i] = m[i].ID
|
|
|
|
}
|
|
|
|
return auo.RemoveMetaIDs(ids...)
|
|
|
|
}
|
|
|
|
|
2024-02-14 10:19:13 +00:00
|
|
|
// Where appends a list predicates to the AlertUpdate builder.
|
|
|
|
func (auo *AlertUpdateOne) Where(ps ...predicate.Alert) *AlertUpdateOne {
|
|
|
|
auo.mutation.Where(ps...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-10-22 14:15:57 +00:00
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
|
|
// The default is selecting all fields defined in the entity schema.
|
|
|
|
func (auo *AlertUpdateOne) Select(field string, fields ...string) *AlertUpdateOne {
|
|
|
|
auo.fields = append([]string{field}, fields...)
|
|
|
|
return auo
|
|
|
|
}
|
|
|
|
|
2021-01-14 15:27:45 +00:00
|
|
|
// Save executes the query and returns the updated Alert entity.
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) Save(ctx context.Context) (*Alert, error) {
|
2022-01-19 13:56:05 +00:00
|
|
|
auo.defaults()
|
2024-02-14 10:19:13 +00:00
|
|
|
return withHooks(ctx, auo.sqlSave, auo.mutation, auo.hooks)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
|
|
func (auo *AlertUpdateOne) SaveX(ctx context.Context) *Alert {
|
|
|
|
node, err := auo.Save(ctx)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return node
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exec executes the query on the entity.
|
|
|
|
func (auo *AlertUpdateOne) Exec(ctx context.Context) error {
|
|
|
|
_, err := auo.Save(ctx)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
|
|
func (auo *AlertUpdateOne) ExecX(ctx context.Context) {
|
|
|
|
if err := auo.Exec(ctx); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-19 13:56:05 +00:00
|
|
|
// defaults sets the default values of the builder before save.
|
|
|
|
func (auo *AlertUpdateOne) defaults() {
|
|
|
|
if _, ok := auo.mutation.CreatedAt(); !ok && !auo.mutation.CreatedAtCleared() {
|
|
|
|
v := alert.UpdateDefaultCreatedAt()
|
|
|
|
auo.mutation.SetCreatedAt(v)
|
|
|
|
}
|
|
|
|
if _, ok := auo.mutation.UpdatedAt(); !ok && !auo.mutation.UpdatedAtCleared() {
|
|
|
|
v := alert.UpdateDefaultUpdatedAt()
|
|
|
|
auo.mutation.SetUpdatedAt(v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-30 09:37:17 +00:00
|
|
|
func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error) {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec := sqlgraph.NewUpdateSpec(alert.Table, alert.Columns, sqlgraph.NewFieldSpec(alert.FieldID, field.TypeInt))
|
2020-11-30 09:37:17 +00:00
|
|
|
id, ok := auo.mutation.ID()
|
|
|
|
if !ok {
|
2022-03-17 13:12:13 +00:00
|
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Alert.id" for update`)}
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
_spec.Node.ID.Value = id
|
2021-10-22 14:15:57 +00:00
|
|
|
if fields := auo.fields; len(fields) > 0 {
|
|
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
|
|
_spec.Node.Columns = append(_spec.Node.Columns, alert.FieldID)
|
|
|
|
for _, f := range fields {
|
|
|
|
if !alert.ValidColumn(f) {
|
|
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
|
|
}
|
|
|
|
if f != alert.FieldID {
|
|
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-15 17:46:52 +00:00
|
|
|
if ps := auo.mutation.predicates; len(ps) > 0 {
|
|
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
|
|
for i := range ps {
|
|
|
|
ps[i](selector)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if value, ok := auo.mutation.CreatedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldCreatedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
2022-01-19 13:56:05 +00:00
|
|
|
if auo.mutation.CreatedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldCreatedAt, field.TypeTime)
|
2022-01-19 13:56:05 +00:00
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if value, ok := auo.mutation.UpdatedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
2022-01-19 13:56:05 +00:00
|
|
|
if auo.mutation.UpdatedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldUpdatedAt, field.TypeTime)
|
2022-01-19 13:56:05 +00:00
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if value, ok := auo.mutation.Scenario(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldScenario, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.BucketId(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldBucketId, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.BucketIdCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldBucketId, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.Message(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldMessage, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.MessageCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldMessage, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.EventsCount(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldEventsCount, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.AddedEventsCount(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldEventsCount, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.EventsCountCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldEventsCount, field.TypeInt32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.StartedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldStartedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.StartedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldStartedAt, field.TypeTime)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.StoppedAt(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldStoppedAt, field.TypeTime, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.StoppedAtCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldStoppedAt, field.TypeTime)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceIp(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceIp, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceIpCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceIp, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceRange(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceRange, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceRangeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceRange, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceAsNumber(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceAsNumber, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceAsNumberCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceAsNumber, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceAsName(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceAsName, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceAsNameCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceAsName, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceCountry(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceCountry, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceCountryCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceCountry, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceLatitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceLatitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.AddedSourceLatitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldSourceLatitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceLatitudeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceLatitude, field.TypeFloat32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceLongitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceLongitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.AddedSourceLongitude(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldSourceLongitude, field.TypeFloat32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceLongitudeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceLongitude, field.TypeFloat32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceScope(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceScope, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceScopeCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceScope, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.SourceValue(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSourceValue, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.SourceValueCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldSourceValue, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.Capacity(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldCapacity, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.AddedCapacity(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.AddField(alert.FieldCapacity, field.TypeInt32, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.CapacityCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldCapacity, field.TypeInt32)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.LeakSpeed(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldLeakSpeed, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.LeakSpeedCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldLeakSpeed, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.ScenarioVersion(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldScenarioVersion, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.ScenarioVersionCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldScenarioVersion, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.ScenarioHash(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldScenarioHash, field.TypeString, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.ScenarioHashCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldScenarioHash, field.TypeString)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
if value, ok := auo.mutation.Simulated(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldSimulated, field.TypeBool, value)
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
2023-01-31 13:47:44 +00:00
|
|
|
if value, ok := auo.mutation.UUID(); ok {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.SetField(alert.FieldUUID, field.TypeString, value)
|
2023-01-31 13:47:44 +00:00
|
|
|
}
|
|
|
|
if auo.mutation.UUIDCleared() {
|
2024-02-14 10:19:13 +00:00
|
|
|
_spec.ClearField(alert.FieldUUID, field.TypeString)
|
2023-01-31 13:47:44 +00:00
|
|
|
}
|
2020-11-30 09:37:17 +00:00
|
|
|
if auo.mutation.OwnerCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: alert.OwnerTable,
|
|
|
|
Columns: []string{alert.OwnerColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.OwnerIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: alert.OwnerTable,
|
|
|
|
Columns: []string{alert.OwnerColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(machine.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if auo.mutation.DecisionsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.DecisionsTable,
|
|
|
|
Columns: []string{alert.DecisionsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.RemovedDecisionsIDs(); len(nodes) > 0 && !auo.mutation.DecisionsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.DecisionsTable,
|
|
|
|
Columns: []string{alert.DecisionsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.DecisionsIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.DecisionsTable,
|
|
|
|
Columns: []string{alert.DecisionsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(decision.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if auo.mutation.EventsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.EventsTable,
|
|
|
|
Columns: []string{alert.EventsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.RemovedEventsIDs(); len(nodes) > 0 && !auo.mutation.EventsCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.EventsTable,
|
|
|
|
Columns: []string{alert.EventsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.EventsIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.EventsTable,
|
|
|
|
Columns: []string{alert.EventsColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(event.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if auo.mutation.MetasCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.MetasTable,
|
|
|
|
Columns: []string{alert.MetasColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.RemovedMetasIDs(); len(nodes) > 0 && !auo.mutation.MetasCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.MetasTable,
|
|
|
|
Columns: []string{alert.MetasColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := auo.mutation.MetasIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.O2M,
|
|
|
|
Inverse: false,
|
|
|
|
Table: alert.MetasTable,
|
|
|
|
Columns: []string{alert.MetasColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2024-02-14 10:19:13 +00:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(meta.FieldID, field.TypeInt),
|
2020-11-30 09:37:17 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
_node = &Alert{config: auo.config}
|
|
|
|
_spec.Assign = _node.assignValues
|
2021-01-14 15:27:45 +00:00
|
|
|
_spec.ScanValues = _node.scanValues
|
2020-11-30 09:37:17 +00:00
|
|
|
if err = sqlgraph.UpdateNode(ctx, auo.driver, _spec); err != nil {
|
|
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
|
|
err = &NotFoundError{alert.Label}
|
2021-10-22 14:15:57 +00:00
|
|
|
} else if sqlgraph.IsConstraintError(err) {
|
2022-10-06 12:55:42 +00:00
|
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
2020-11-30 09:37:17 +00:00
|
|
|
}
|
|
|
|
return nil, err
|
|
|
|
}
|
2024-02-14 10:19:13 +00:00
|
|
|
auo.mutation.done = true
|
2020-11-30 09:37:17 +00:00
|
|
|
return _node, nil
|
|
|
|
}
|