ent

package
v0.0.0-...-236fc01 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeAlert    = "Alert"
	TypeBouncer  = "Bouncer"
	TypeDecision = "Decision"
	TypeEvent    = "Event"
	TypeMachine  = "Machine"
	TypeMeta     = "Meta"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validaton error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector, func(string) bool) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Alert

type Alert struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Scenario holds the value of the "scenario" field.
	Scenario string `json:"scenario,omitempty"`
	// BucketId holds the value of the "bucketId" field.
	BucketId string `json:"bucketId,omitempty"`
	// Message holds the value of the "message" field.
	Message string `json:"message,omitempty"`
	// EventsCount holds the value of the "eventsCount" field.
	EventsCount int32 `json:"eventsCount,omitempty"`
	// StartedAt holds the value of the "startedAt" field.
	StartedAt time.Time `json:"startedAt,omitempty"`
	// StoppedAt holds the value of the "stoppedAt" field.
	StoppedAt time.Time `json:"stoppedAt,omitempty"`
	// SourceIp holds the value of the "sourceIp" field.
	SourceIp string `json:"sourceIp,omitempty"`
	// SourceRange holds the value of the "sourceRange" field.
	SourceRange string `json:"sourceRange,omitempty"`
	// SourceAsNumber holds the value of the "sourceAsNumber" field.
	SourceAsNumber string `json:"sourceAsNumber,omitempty"`
	// SourceAsName holds the value of the "sourceAsName" field.
	SourceAsName string `json:"sourceAsName,omitempty"`
	// SourceCountry holds the value of the "sourceCountry" field.
	SourceCountry string `json:"sourceCountry,omitempty"`
	// SourceLatitude holds the value of the "sourceLatitude" field.
	SourceLatitude float32 `json:"sourceLatitude,omitempty"`
	// SourceLongitude holds the value of the "sourceLongitude" field.
	SourceLongitude float32 `json:"sourceLongitude,omitempty"`
	// SourceScope holds the value of the "sourceScope" field.
	SourceScope string `json:"sourceScope,omitempty"`
	// SourceValue holds the value of the "sourceValue" field.
	SourceValue string `json:"sourceValue,omitempty"`
	// Capacity holds the value of the "capacity" field.
	Capacity int32 `json:"capacity,omitempty"`
	// LeakSpeed holds the value of the "leakSpeed" field.
	LeakSpeed string `json:"leakSpeed,omitempty"`
	// ScenarioVersion holds the value of the "scenarioVersion" field.
	ScenarioVersion string `json:"scenarioVersion,omitempty"`
	// ScenarioHash holds the value of the "scenarioHash" field.
	ScenarioHash string `json:"scenarioHash,omitempty"`
	// Simulated holds the value of the "simulated" field.
	Simulated bool `json:"simulated,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the AlertQuery when eager-loading is set.
	Edges AlertEdges `json:"edges"`
	// contains filtered or unexported fields
}

Alert is the model entity for the Alert schema.

func (*Alert) QueryDecisions

func (a *Alert) QueryDecisions() *DecisionQuery

QueryDecisions queries the "decisions" edge of the Alert entity.

func (*Alert) QueryEvents

func (a *Alert) QueryEvents() *EventQuery

QueryEvents queries the "events" edge of the Alert entity.

func (*Alert) QueryMetas

func (a *Alert) QueryMetas() *MetaQuery

QueryMetas queries the "metas" edge of the Alert entity.

func (*Alert) QueryOwner

func (a *Alert) QueryOwner() *MachineQuery

QueryOwner queries the "owner" edge of the Alert entity.

func (*Alert) String

func (a *Alert) String() string

String implements the fmt.Stringer.

func (*Alert) Unwrap

func (a *Alert) Unwrap() *Alert

Unwrap unwraps the Alert entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Alert) Update

func (a *Alert) Update() *AlertUpdateOne

Update returns a builder for updating this Alert. Note that you need to call Alert.Unwrap() before calling this method if this Alert was returned from a transaction, and the transaction was committed or rolled back.

type AlertClient

type AlertClient struct {
	// contains filtered or unexported fields
}

AlertClient is a client for the Alert schema.

func NewAlertClient

func NewAlertClient(c config) *AlertClient

NewAlertClient returns a client for the Alert from the given config.

func (*AlertClient) Create

func (c *AlertClient) Create() *AlertCreate

Create returns a create builder for Alert.

func (*AlertClient) CreateBulk

func (c *AlertClient) CreateBulk(builders ...*AlertCreate) *AlertCreateBulk

CreateBulk returns a builder for creating a bulk of Alert entities.

func (*AlertClient) Delete

func (c *AlertClient) Delete() *AlertDelete

Delete returns a delete builder for Alert.

func (*AlertClient) DeleteOne

func (c *AlertClient) DeleteOne(a *Alert) *AlertDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*AlertClient) DeleteOneID

func (c *AlertClient) DeleteOneID(id int) *AlertDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*AlertClient) Get

func (c *AlertClient) Get(ctx context.Context, id int) (*Alert, error)

Get returns a Alert entity by its id.

func (*AlertClient) GetX

func (c *AlertClient) GetX(ctx context.Context, id int) *Alert

GetX is like Get, but panics if an error occurs.

func (*AlertClient) Hooks

func (c *AlertClient) Hooks() []Hook

Hooks returns the client hooks.

func (*AlertClient) Query

func (c *AlertClient) Query() *AlertQuery

Query returns a query builder for Alert.

func (*AlertClient) QueryDecisions

func (c *AlertClient) QueryDecisions(a *Alert) *DecisionQuery

QueryDecisions queries the decisions edge of a Alert.

func (*AlertClient) QueryEvents

func (c *AlertClient) QueryEvents(a *Alert) *EventQuery

QueryEvents queries the events edge of a Alert.

func (*AlertClient) QueryMetas

func (c *AlertClient) QueryMetas(a *Alert) *MetaQuery

QueryMetas queries the metas edge of a Alert.

func (*AlertClient) QueryOwner

func (c *AlertClient) QueryOwner(a *Alert) *MachineQuery

QueryOwner queries the owner edge of a Alert.

func (*AlertClient) Update

func (c *AlertClient) Update() *AlertUpdate

Update returns an update builder for Alert.

func (*AlertClient) UpdateOne

func (c *AlertClient) UpdateOne(a *Alert) *AlertUpdateOne

UpdateOne returns an update builder for the given entity.

func (*AlertClient) UpdateOneID

func (c *AlertClient) UpdateOneID(id int) *AlertUpdateOne

UpdateOneID returns an update builder for the given id.

func (*AlertClient) Use

func (c *AlertClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `alert.Hooks(f(g(h())))`.

type AlertCreate

type AlertCreate struct {
	// contains filtered or unexported fields
}

AlertCreate is the builder for creating a Alert entity.

func (*AlertCreate) AddDecisionIDs

func (ac *AlertCreate) AddDecisionIDs(ids ...int) *AlertCreate

AddDecisionIDs adds the "decisions" edge to the Decision entity by IDs.

func (*AlertCreate) AddDecisions

func (ac *AlertCreate) AddDecisions(d ...*Decision) *AlertCreate

AddDecisions adds the "decisions" edges to the Decision entity.

func (*AlertCreate) AddEventIDs

func (ac *AlertCreate) AddEventIDs(ids ...int) *AlertCreate

AddEventIDs adds the "events" edge to the Event entity by IDs.

func (*AlertCreate) AddEvents

func (ac *AlertCreate) AddEvents(e ...*Event) *AlertCreate

AddEvents adds the "events" edges to the Event entity.

func (*AlertCreate) AddMetaIDs

func (ac *AlertCreate) AddMetaIDs(ids ...int) *AlertCreate

AddMetaIDs adds the "metas" edge to the Meta entity by IDs.

func (*AlertCreate) AddMetas

func (ac *AlertCreate) AddMetas(m ...*Meta) *AlertCreate

AddMetas adds the "metas" edges to the Meta entity.

func (*AlertCreate) Mutation

func (ac *AlertCreate) Mutation() *AlertMutation

Mutation returns the AlertMutation object of the builder.

func (*AlertCreate) Save

func (ac *AlertCreate) Save(ctx context.Context) (*Alert, error)

Save creates the Alert in the database.

func (*AlertCreate) SaveX

func (ac *AlertCreate) SaveX(ctx context.Context) *Alert

SaveX calls Save and panics if Save returns an error.

func (*AlertCreate) SetBucketId

func (ac *AlertCreate) SetBucketId(s string) *AlertCreate

SetBucketId sets the "bucketId" field.

func (*AlertCreate) SetCapacity

func (ac *AlertCreate) SetCapacity(i int32) *AlertCreate

SetCapacity sets the "capacity" field.

func (*AlertCreate) SetCreatedAt

func (ac *AlertCreate) SetCreatedAt(t time.Time) *AlertCreate

SetCreatedAt sets the "created_at" field.

func (*AlertCreate) SetEventsCount

func (ac *AlertCreate) SetEventsCount(i int32) *AlertCreate

SetEventsCount sets the "eventsCount" field.

func (*AlertCreate) SetLeakSpeed

func (ac *AlertCreate) SetLeakSpeed(s string) *AlertCreate

SetLeakSpeed sets the "leakSpeed" field.

func (*AlertCreate) SetMessage

func (ac *AlertCreate) SetMessage(s string) *AlertCreate

SetMessage sets the "message" field.

func (*AlertCreate) SetNillableBucketId

func (ac *AlertCreate) SetNillableBucketId(s *string) *AlertCreate

SetNillableBucketId sets the "bucketId" field if the given value is not nil.

func (*AlertCreate) SetNillableCapacity

func (ac *AlertCreate) SetNillableCapacity(i *int32) *AlertCreate

SetNillableCapacity sets the "capacity" field if the given value is not nil.

func (*AlertCreate) SetNillableCreatedAt

func (ac *AlertCreate) SetNillableCreatedAt(t *time.Time) *AlertCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*AlertCreate) SetNillableEventsCount

func (ac *AlertCreate) SetNillableEventsCount(i *int32) *AlertCreate

SetNillableEventsCount sets the "eventsCount" field if the given value is not nil.

func (*AlertCreate) SetNillableLeakSpeed

func (ac *AlertCreate) SetNillableLeakSpeed(s *string) *AlertCreate

SetNillableLeakSpeed sets the "leakSpeed" field if the given value is not nil.

func (*AlertCreate) SetNillableMessage

func (ac *AlertCreate) SetNillableMessage(s *string) *AlertCreate

SetNillableMessage sets the "message" field if the given value is not nil.

func (*AlertCreate) SetNillableOwnerID

func (ac *AlertCreate) SetNillableOwnerID(id *int) *AlertCreate

SetNillableOwnerID sets the "owner" edge to the Machine entity by ID if the given value is not nil.

func (*AlertCreate) SetNillableScenarioHash

func (ac *AlertCreate) SetNillableScenarioHash(s *string) *AlertCreate

SetNillableScenarioHash sets the "scenarioHash" field if the given value is not nil.

func (*AlertCreate) SetNillableScenarioVersion

func (ac *AlertCreate) SetNillableScenarioVersion(s *string) *AlertCreate

SetNillableScenarioVersion sets the "scenarioVersion" field if the given value is not nil.

func (*AlertCreate) SetNillableSimulated

func (ac *AlertCreate) SetNillableSimulated(b *bool) *AlertCreate

SetNillableSimulated sets the "simulated" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceAsName

func (ac *AlertCreate) SetNillableSourceAsName(s *string) *AlertCreate

SetNillableSourceAsName sets the "sourceAsName" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceAsNumber

func (ac *AlertCreate) SetNillableSourceAsNumber(s *string) *AlertCreate

SetNillableSourceAsNumber sets the "sourceAsNumber" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceCountry

func (ac *AlertCreate) SetNillableSourceCountry(s *string) *AlertCreate

SetNillableSourceCountry sets the "sourceCountry" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceIp

func (ac *AlertCreate) SetNillableSourceIp(s *string) *AlertCreate

SetNillableSourceIp sets the "sourceIp" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceLatitude

func (ac *AlertCreate) SetNillableSourceLatitude(f *float32) *AlertCreate

SetNillableSourceLatitude sets the "sourceLatitude" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceLongitude

func (ac *AlertCreate) SetNillableSourceLongitude(f *float32) *AlertCreate

SetNillableSourceLongitude sets the "sourceLongitude" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceRange

func (ac *AlertCreate) SetNillableSourceRange(s *string) *AlertCreate

SetNillableSourceRange sets the "sourceRange" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceScope

func (ac *AlertCreate) SetNillableSourceScope(s *string) *AlertCreate

SetNillableSourceScope sets the "sourceScope" field if the given value is not nil.

func (*AlertCreate) SetNillableSourceValue

func (ac *AlertCreate) SetNillableSourceValue(s *string) *AlertCreate

SetNillableSourceValue sets the "sourceValue" field if the given value is not nil.

func (*AlertCreate) SetNillableStartedAt

func (ac *AlertCreate) SetNillableStartedAt(t *time.Time) *AlertCreate

SetNillableStartedAt sets the "startedAt" field if the given value is not nil.

func (*AlertCreate) SetNillableStoppedAt

func (ac *AlertCreate) SetNillableStoppedAt(t *time.Time) *AlertCreate

SetNillableStoppedAt sets the "stoppedAt" field if the given value is not nil.

func (*AlertCreate) SetNillableUpdatedAt

func (ac *AlertCreate) SetNillableUpdatedAt(t *time.Time) *AlertCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*AlertCreate) SetOwner

func (ac *AlertCreate) SetOwner(m *Machine) *AlertCreate

SetOwner sets the "owner" edge to the Machine entity.

func (*AlertCreate) SetOwnerID

func (ac *AlertCreate) SetOwnerID(id int) *AlertCreate

SetOwnerID sets the "owner" edge to the Machine entity by ID.

func (*AlertCreate) SetScenario

func (ac *AlertCreate) SetScenario(s string) *AlertCreate

SetScenario sets the "scenario" field.

func (*AlertCreate) SetScenarioHash

func (ac *AlertCreate) SetScenarioHash(s string) *AlertCreate

SetScenarioHash sets the "scenarioHash" field.

func (*AlertCreate) SetScenarioVersion

func (ac *AlertCreate) SetScenarioVersion(s string) *AlertCreate

SetScenarioVersion sets the "scenarioVersion" field.

func (*AlertCreate) SetSimulated

func (ac *AlertCreate) SetSimulated(b bool) *AlertCreate

SetSimulated sets the "simulated" field.

func (*AlertCreate) SetSourceAsName

func (ac *AlertCreate) SetSourceAsName(s string) *AlertCreate

SetSourceAsName sets the "sourceAsName" field.

func (*AlertCreate) SetSourceAsNumber

func (ac *AlertCreate) SetSourceAsNumber(s string) *AlertCreate

SetSourceAsNumber sets the "sourceAsNumber" field.

func (*AlertCreate) SetSourceCountry

func (ac *AlertCreate) SetSourceCountry(s string) *AlertCreate

SetSourceCountry sets the "sourceCountry" field.

func (*AlertCreate) SetSourceIp

func (ac *AlertCreate) SetSourceIp(s string) *AlertCreate

SetSourceIp sets the "sourceIp" field.

func (*AlertCreate) SetSourceLatitude

func (ac *AlertCreate) SetSourceLatitude(f float32) *AlertCreate

SetSourceLatitude sets the "sourceLatitude" field.

func (*AlertCreate) SetSourceLongitude

func (ac *AlertCreate) SetSourceLongitude(f float32) *AlertCreate

SetSourceLongitude sets the "sourceLongitude" field.

func (*AlertCreate) SetSourceRange

func (ac *AlertCreate) SetSourceRange(s string) *AlertCreate

SetSourceRange sets the "sourceRange" field.

func (*AlertCreate) SetSourceScope

func (ac *AlertCreate) SetSourceScope(s string) *AlertCreate

SetSourceScope sets the "sourceScope" field.

func (*AlertCreate) SetSourceValue

func (ac *AlertCreate) SetSourceValue(s string) *AlertCreate

SetSourceValue sets the "sourceValue" field.

func (*AlertCreate) SetStartedAt

func (ac *AlertCreate) SetStartedAt(t time.Time) *AlertCreate

SetStartedAt sets the "startedAt" field.

func (*AlertCreate) SetStoppedAt

func (ac *AlertCreate) SetStoppedAt(t time.Time) *AlertCreate

SetStoppedAt sets the "stoppedAt" field.

func (*AlertCreate) SetUpdatedAt

func (ac *AlertCreate) SetUpdatedAt(t time.Time) *AlertCreate

SetUpdatedAt sets the "updated_at" field.

type AlertCreateBulk

type AlertCreateBulk struct {
	// contains filtered or unexported fields
}

AlertCreateBulk is the builder for creating many Alert entities in bulk.

func (*AlertCreateBulk) Save

func (acb *AlertCreateBulk) Save(ctx context.Context) ([]*Alert, error)

Save creates the Alert entities in the database.

func (*AlertCreateBulk) SaveX

func (acb *AlertCreateBulk) SaveX(ctx context.Context) []*Alert

SaveX is like Save, but panics if an error occurs.

type AlertDelete

type AlertDelete struct {
	// contains filtered or unexported fields
}

AlertDelete is the builder for deleting a Alert entity.

func (*AlertDelete) Exec

func (ad *AlertDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*AlertDelete) ExecX

func (ad *AlertDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*AlertDelete) Where

func (ad *AlertDelete) Where(ps ...predicate.Alert) *AlertDelete

Where adds a new predicate to the AlertDelete builder.

type AlertDeleteOne

type AlertDeleteOne struct {
	// contains filtered or unexported fields
}

AlertDeleteOne is the builder for deleting a single Alert entity.

func (*AlertDeleteOne) Exec

func (ado *AlertDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*AlertDeleteOne) ExecX

func (ado *AlertDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type AlertEdges

type AlertEdges struct {
	// Owner holds the value of the owner edge.
	Owner *Machine `json:"owner,omitempty"`
	// Decisions holds the value of the decisions edge.
	Decisions []*Decision `json:"decisions,omitempty"`
	// Events holds the value of the events edge.
	Events []*Event `json:"events,omitempty"`
	// Metas holds the value of the metas edge.
	Metas []*Meta `json:"metas,omitempty"`
	// contains filtered or unexported fields
}

AlertEdges holds the relations/edges for other nodes in the graph.

func (AlertEdges) DecisionsOrErr

func (e AlertEdges) DecisionsOrErr() ([]*Decision, error)

DecisionsOrErr returns the Decisions value or an error if the edge was not loaded in eager-loading.

func (AlertEdges) EventsOrErr

func (e AlertEdges) EventsOrErr() ([]*Event, error)

EventsOrErr returns the Events value or an error if the edge was not loaded in eager-loading.

func (AlertEdges) MetasOrErr

func (e AlertEdges) MetasOrErr() ([]*Meta, error)

MetasOrErr returns the Metas value or an error if the edge was not loaded in eager-loading.

func (AlertEdges) OwnerOrErr

func (e AlertEdges) OwnerOrErr() (*Machine, error)

OwnerOrErr returns the Owner value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type AlertGroupBy

type AlertGroupBy struct {
	// contains filtered or unexported fields
}

AlertGroupBy is the group-by builder for Alert entities.

func (*AlertGroupBy) Aggregate

func (agb *AlertGroupBy) Aggregate(fns ...AggregateFunc) *AlertGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*AlertGroupBy) Bool

func (agb *AlertGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) BoolX

func (agb *AlertGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*AlertGroupBy) Bools

func (agb *AlertGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) BoolsX

func (agb *AlertGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*AlertGroupBy) Float64

func (agb *AlertGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) Float64X

func (agb *AlertGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*AlertGroupBy) Float64s

func (agb *AlertGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) Float64sX

func (agb *AlertGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*AlertGroupBy) Int

func (agb *AlertGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) IntX

func (agb *AlertGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*AlertGroupBy) Ints

func (agb *AlertGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) IntsX

func (agb *AlertGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*AlertGroupBy) Scan

func (agb *AlertGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*AlertGroupBy) ScanX

func (agb *AlertGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*AlertGroupBy) String

func (agb *AlertGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) StringX

func (agb *AlertGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*AlertGroupBy) Strings

func (agb *AlertGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*AlertGroupBy) StringsX

func (agb *AlertGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type AlertMutation

type AlertMutation struct {
	// contains filtered or unexported fields
}

AlertMutation represents an operation that mutates the Alert nodes in the graph.

func (*AlertMutation) AddCapacity

func (m *AlertMutation) AddCapacity(i int32)

AddCapacity adds i to the "capacity" field.

func (*AlertMutation) AddDecisionIDs

func (m *AlertMutation) AddDecisionIDs(ids ...int)

AddDecisionIDs adds the "decisions" edge to the Decision entity by ids.

func (*AlertMutation) AddEventIDs

func (m *AlertMutation) AddEventIDs(ids ...int)

AddEventIDs adds the "events" edge to the Event entity by ids.

func (*AlertMutation) AddEventsCount

func (m *AlertMutation) AddEventsCount(i int32)

AddEventsCount adds i to the "eventsCount" field.

func (*AlertMutation) AddField

func (m *AlertMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*AlertMutation) AddMetaIDs

func (m *AlertMutation) AddMetaIDs(ids ...int)

AddMetaIDs adds the "metas" edge to the Meta entity by ids.

func (*AlertMutation) AddSourceLatitude

func (m *AlertMutation) AddSourceLatitude(f float32)

AddSourceLatitude adds f to the "sourceLatitude" field.

func (*AlertMutation) AddSourceLongitude

func (m *AlertMutation) AddSourceLongitude(f float32)

AddSourceLongitude adds f to the "sourceLongitude" field.

func (*AlertMutation) AddedCapacity

func (m *AlertMutation) AddedCapacity() (r int32, exists bool)

AddedCapacity returns the value that was added to the "capacity" field in this mutation.

func (*AlertMutation) AddedEdges

func (m *AlertMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*AlertMutation) AddedEventsCount

func (m *AlertMutation) AddedEventsCount() (r int32, exists bool)

AddedEventsCount returns the value that was added to the "eventsCount" field in this mutation.

func (*AlertMutation) AddedField

func (m *AlertMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*AlertMutation) AddedFields

func (m *AlertMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*AlertMutation) AddedIDs

func (m *AlertMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*AlertMutation) AddedSourceLatitude

func (m *AlertMutation) AddedSourceLatitude() (r float32, exists bool)

AddedSourceLatitude returns the value that was added to the "sourceLatitude" field in this mutation.

func (*AlertMutation) AddedSourceLongitude

func (m *AlertMutation) AddedSourceLongitude() (r float32, exists bool)

AddedSourceLongitude returns the value that was added to the "sourceLongitude" field in this mutation.

func (*AlertMutation) BucketId

func (m *AlertMutation) BucketId() (r string, exists bool)

BucketId returns the value of the "bucketId" field in the mutation.

func (*AlertMutation) BucketIdCleared

func (m *AlertMutation) BucketIdCleared() bool

BucketIdCleared returns if the "bucketId" field was cleared in this mutation.

func (*AlertMutation) Capacity

func (m *AlertMutation) Capacity() (r int32, exists bool)

Capacity returns the value of the "capacity" field in the mutation.

func (*AlertMutation) CapacityCleared

func (m *AlertMutation) CapacityCleared() bool

CapacityCleared returns if the "capacity" field was cleared in this mutation.

func (*AlertMutation) ClearBucketId

func (m *AlertMutation) ClearBucketId()

ClearBucketId clears the value of the "bucketId" field.

func (*AlertMutation) ClearCapacity

func (m *AlertMutation) ClearCapacity()

ClearCapacity clears the value of the "capacity" field.

func (*AlertMutation) ClearDecisions

func (m *AlertMutation) ClearDecisions()

ClearDecisions clears the "decisions" edge to the Decision entity.

func (*AlertMutation) ClearEdge

func (m *AlertMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*AlertMutation) ClearEvents

func (m *AlertMutation) ClearEvents()

ClearEvents clears the "events" edge to the Event entity.

func (*AlertMutation) ClearEventsCount

func (m *AlertMutation) ClearEventsCount()

ClearEventsCount clears the value of the "eventsCount" field.

func (*AlertMutation) ClearField

func (m *AlertMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*AlertMutation) ClearLeakSpeed

func (m *AlertMutation) ClearLeakSpeed()

ClearLeakSpeed clears the value of the "leakSpeed" field.

func (*AlertMutation) ClearMessage

func (m *AlertMutation) ClearMessage()

ClearMessage clears the value of the "message" field.

func (*AlertMutation) ClearMetas

func (m *AlertMutation) ClearMetas()

ClearMetas clears the "metas" edge to the Meta entity.

func (*AlertMutation) ClearOwner

func (m *AlertMutation) ClearOwner()

ClearOwner clears the "owner" edge to the Machine entity.

func (*AlertMutation) ClearScenarioHash

func (m *AlertMutation) ClearScenarioHash()

ClearScenarioHash clears the value of the "scenarioHash" field.

func (*AlertMutation) ClearScenarioVersion

func (m *AlertMutation) ClearScenarioVersion()

ClearScenarioVersion clears the value of the "scenarioVersion" field.

func (*AlertMutation) ClearSourceAsName

func (m *AlertMutation) ClearSourceAsName()

ClearSourceAsName clears the value of the "sourceAsName" field.

func (*AlertMutation) ClearSourceAsNumber

func (m *AlertMutation) ClearSourceAsNumber()

ClearSourceAsNumber clears the value of the "sourceAsNumber" field.

func (*AlertMutation) ClearSourceCountry

func (m *AlertMutation) ClearSourceCountry()

ClearSourceCountry clears the value of the "sourceCountry" field.

func (*AlertMutation) ClearSourceIp

func (m *AlertMutation) ClearSourceIp()

ClearSourceIp clears the value of the "sourceIp" field.

func (*AlertMutation) ClearSourceLatitude

func (m *AlertMutation) ClearSourceLatitude()

ClearSourceLatitude clears the value of the "sourceLatitude" field.

func (*AlertMutation) ClearSourceLongitude

func (m *AlertMutation) ClearSourceLongitude()

ClearSourceLongitude clears the value of the "sourceLongitude" field.

func (*AlertMutation) ClearSourceRange

func (m *AlertMutation) ClearSourceRange()

ClearSourceRange clears the value of the "sourceRange" field.

func (*AlertMutation) ClearSourceScope

func (m *AlertMutation) ClearSourceScope()

ClearSourceScope clears the value of the "sourceScope" field.

func (*AlertMutation) ClearSourceValue

func (m *AlertMutation) ClearSourceValue()

ClearSourceValue clears the value of the "sourceValue" field.

func (*AlertMutation) ClearStartedAt

func (m *AlertMutation) ClearStartedAt()

ClearStartedAt clears the value of the "startedAt" field.

func (*AlertMutation) ClearStoppedAt

func (m *AlertMutation) ClearStoppedAt()

ClearStoppedAt clears the value of the "stoppedAt" field.

func (*AlertMutation) ClearedEdges

func (m *AlertMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*AlertMutation) ClearedFields

func (m *AlertMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (AlertMutation) Client

func (m AlertMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*AlertMutation) CreatedAt

func (m *AlertMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*AlertMutation) DecisionsCleared

func (m *AlertMutation) DecisionsCleared() bool

DecisionsCleared returns if the "decisions" edge to the Decision entity was cleared.

func (*AlertMutation) DecisionsIDs

func (m *AlertMutation) DecisionsIDs() (ids []int)

DecisionsIDs returns the "decisions" edge IDs in the mutation.

func (*AlertMutation) EdgeCleared

func (m *AlertMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*AlertMutation) EventsCleared

func (m *AlertMutation) EventsCleared() bool

EventsCleared returns if the "events" edge to the Event entity was cleared.

func (*AlertMutation) EventsCount

func (m *AlertMutation) EventsCount() (r int32, exists bool)

EventsCount returns the value of the "eventsCount" field in the mutation.

func (*AlertMutation) EventsCountCleared

func (m *AlertMutation) EventsCountCleared() bool

EventsCountCleared returns if the "eventsCount" field was cleared in this mutation.

func (*AlertMutation) EventsIDs

func (m *AlertMutation) EventsIDs() (ids []int)

EventsIDs returns the "events" edge IDs in the mutation.

func (*AlertMutation) Field

func (m *AlertMutation) Field(name string) (ent.Value, bool)

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*AlertMutation) FieldCleared

func (m *AlertMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*AlertMutation) Fields

func (m *AlertMutation) Fields() []string

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*AlertMutation) ID

func (m *AlertMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder.

func (*AlertMutation) LeakSpeed

func (m *AlertMutation) LeakSpeed() (r string, exists bool)

LeakSpeed returns the value of the "leakSpeed" field in the mutation.

func (*AlertMutation) LeakSpeedCleared

func (m *AlertMutation) LeakSpeedCleared() bool

LeakSpeedCleared returns if the "leakSpeed" field was cleared in this mutation.

func (*AlertMutation) Message

func (m *AlertMutation) Message() (r string, exists bool)

Message returns the value of the "message" field in the mutation.

func (*AlertMutation) MessageCleared

func (m *AlertMutation) MessageCleared() bool

MessageCleared returns if the "message" field was cleared in this mutation.

func (*AlertMutation) MetasCleared

func (m *AlertMutation) MetasCleared() bool

MetasCleared returns if the "metas" edge to the Meta entity was cleared.

func (*AlertMutation) MetasIDs

func (m *AlertMutation) MetasIDs() (ids []int)

MetasIDs returns the "metas" edge IDs in the mutation.

func (*AlertMutation) OldBucketId

func (m *AlertMutation) OldBucketId(ctx context.Context) (v string, err error)

OldBucketId returns the old "bucketId" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldCapacity

func (m *AlertMutation) OldCapacity(ctx context.Context) (v int32, err error)

OldCapacity returns the old "capacity" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldCreatedAt

func (m *AlertMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldEventsCount

func (m *AlertMutation) OldEventsCount(ctx context.Context) (v int32, err error)

OldEventsCount returns the old "eventsCount" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldField

func (m *AlertMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*AlertMutation) OldLeakSpeed

func (m *AlertMutation) OldLeakSpeed(ctx context.Context) (v string, err error)

OldLeakSpeed returns the old "leakSpeed" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldMessage

func (m *AlertMutation) OldMessage(ctx context.Context) (v string, err error)

OldMessage returns the old "message" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldScenario

func (m *AlertMutation) OldScenario(ctx context.Context) (v string, err error)

OldScenario returns the old "scenario" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldScenarioHash

func (m *AlertMutation) OldScenarioHash(ctx context.Context) (v string, err error)

OldScenarioHash returns the old "scenarioHash" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldScenarioVersion

func (m *AlertMutation) OldScenarioVersion(ctx context.Context) (v string, err error)

OldScenarioVersion returns the old "scenarioVersion" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSimulated

func (m *AlertMutation) OldSimulated(ctx context.Context) (v bool, err error)

OldSimulated returns the old "simulated" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceAsName

func (m *AlertMutation) OldSourceAsName(ctx context.Context) (v string, err error)

OldSourceAsName returns the old "sourceAsName" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceAsNumber

func (m *AlertMutation) OldSourceAsNumber(ctx context.Context) (v string, err error)

OldSourceAsNumber returns the old "sourceAsNumber" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceCountry

func (m *AlertMutation) OldSourceCountry(ctx context.Context) (v string, err error)

OldSourceCountry returns the old "sourceCountry" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceIp

func (m *AlertMutation) OldSourceIp(ctx context.Context) (v string, err error)

OldSourceIp returns the old "sourceIp" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceLatitude

func (m *AlertMutation) OldSourceLatitude(ctx context.Context) (v float32, err error)

OldSourceLatitude returns the old "sourceLatitude" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceLongitude

func (m *AlertMutation) OldSourceLongitude(ctx context.Context) (v float32, err error)

OldSourceLongitude returns the old "sourceLongitude" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceRange

func (m *AlertMutation) OldSourceRange(ctx context.Context) (v string, err error)

OldSourceRange returns the old "sourceRange" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceScope

func (m *AlertMutation) OldSourceScope(ctx context.Context) (v string, err error)

OldSourceScope returns the old "sourceScope" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldSourceValue

func (m *AlertMutation) OldSourceValue(ctx context.Context) (v string, err error)

OldSourceValue returns the old "sourceValue" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldStartedAt

func (m *AlertMutation) OldStartedAt(ctx context.Context) (v time.Time, err error)

OldStartedAt returns the old "startedAt" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldStoppedAt

func (m *AlertMutation) OldStoppedAt(ctx context.Context) (v time.Time, err error)

OldStoppedAt returns the old "stoppedAt" field's value of the Alert entity. If the Alert 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 (*AlertMutation) OldUpdatedAt

func (m *AlertMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Alert entity. If the Alert 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 (*AlertMutation) Op

func (m *AlertMutation) Op() Op

Op returns the operation name.

func (*AlertMutation) OwnerCleared

func (m *AlertMutation) OwnerCleared() bool

OwnerCleared returns if the "owner" edge to the Machine entity was cleared.

func (*AlertMutation) OwnerID

func (m *AlertMutation) OwnerID() (id int, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*AlertMutation) OwnerIDs

func (m *AlertMutation) OwnerIDs() (ids []int)

OwnerIDs returns the "owner" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use OwnerID instead. It exists only for internal usage by the builders.

func (*AlertMutation) RemoveDecisionIDs

func (m *AlertMutation) RemoveDecisionIDs(ids ...int)

RemoveDecisionIDs removes the "decisions" edge to the Decision entity by IDs.

func (*AlertMutation) RemoveEventIDs

func (m *AlertMutation) RemoveEventIDs(ids ...int)

RemoveEventIDs removes the "events" edge to the Event entity by IDs.

func (*AlertMutation) RemoveMetaIDs

func (m *AlertMutation) RemoveMetaIDs(ids ...int)

RemoveMetaIDs removes the "metas" edge to the Meta entity by IDs.

func (*AlertMutation) RemovedDecisionsIDs

func (m *AlertMutation) RemovedDecisionsIDs() (ids []int)

RemovedDecisions returns the removed IDs of the "decisions" edge to the Decision entity.

func (*AlertMutation) RemovedEdges

func (m *AlertMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*AlertMutation) RemovedEventsIDs

func (m *AlertMutation) RemovedEventsIDs() (ids []int)

RemovedEvents returns the removed IDs of the "events" edge to the Event entity.

func (*AlertMutation) RemovedIDs

func (m *AlertMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*AlertMutation) RemovedMetasIDs

func (m *AlertMutation) RemovedMetasIDs() (ids []int)

RemovedMetas returns the removed IDs of the "metas" edge to the Meta entity.

func (*AlertMutation) ResetBucketId

func (m *AlertMutation) ResetBucketId()

ResetBucketId resets all changes to the "bucketId" field.

func (*AlertMutation) ResetCapacity

func (m *AlertMutation) ResetCapacity()

ResetCapacity resets all changes to the "capacity" field.

func (*AlertMutation) ResetCreatedAt

func (m *AlertMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*AlertMutation) ResetDecisions

func (m *AlertMutation) ResetDecisions()

ResetDecisions resets all changes to the "decisions" edge.

func (*AlertMutation) ResetEdge

func (m *AlertMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*AlertMutation) ResetEvents

func (m *AlertMutation) ResetEvents()

ResetEvents resets all changes to the "events" edge.

func (*AlertMutation) ResetEventsCount

func (m *AlertMutation) ResetEventsCount()

ResetEventsCount resets all changes to the "eventsCount" field.

func (*AlertMutation) ResetField

func (m *AlertMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*AlertMutation) ResetLeakSpeed

func (m *AlertMutation) ResetLeakSpeed()

ResetLeakSpeed resets all changes to the "leakSpeed" field.

func (*AlertMutation) ResetMessage

func (m *AlertMutation) ResetMessage()

ResetMessage resets all changes to the "message" field.

func (*AlertMutation) ResetMetas

func (m *AlertMutation) ResetMetas()

ResetMetas resets all changes to the "metas" edge.

func (*AlertMutation) ResetOwner

func (m *AlertMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*AlertMutation) ResetScenario

func (m *AlertMutation) ResetScenario()

ResetScenario resets all changes to the "scenario" field.

func (*AlertMutation) ResetScenarioHash

func (m *AlertMutation) ResetScenarioHash()

ResetScenarioHash resets all changes to the "scenarioHash" field.

func (*AlertMutation) ResetScenarioVersion

func (m *AlertMutation) ResetScenarioVersion()

ResetScenarioVersion resets all changes to the "scenarioVersion" field.

func (*AlertMutation) ResetSimulated

func (m *AlertMutation) ResetSimulated()

ResetSimulated resets all changes to the "simulated" field.

func (*AlertMutation) ResetSourceAsName

func (m *AlertMutation) ResetSourceAsName()

ResetSourceAsName resets all changes to the "sourceAsName" field.

func (*AlertMutation) ResetSourceAsNumber

func (m *AlertMutation) ResetSourceAsNumber()

ResetSourceAsNumber resets all changes to the "sourceAsNumber" field.

func (*AlertMutation) ResetSourceCountry

func (m *AlertMutation) ResetSourceCountry()

ResetSourceCountry resets all changes to the "sourceCountry" field.

func (*AlertMutation) ResetSourceIp

func (m *AlertMutation) ResetSourceIp()

ResetSourceIp resets all changes to the "sourceIp" field.

func (*AlertMutation) ResetSourceLatitude

func (m *AlertMutation) ResetSourceLatitude()

ResetSourceLatitude resets all changes to the "sourceLatitude" field.

func (*AlertMutation) ResetSourceLongitude

func (m *AlertMutation) ResetSourceLongitude()

ResetSourceLongitude resets all changes to the "sourceLongitude" field.

func (*AlertMutation) ResetSourceRange

func (m *AlertMutation) ResetSourceRange()

ResetSourceRange resets all changes to the "sourceRange" field.

func (*AlertMutation) ResetSourceScope

func (m *AlertMutation) ResetSourceScope()

ResetSourceScope resets all changes to the "sourceScope" field.

func (*AlertMutation) ResetSourceValue

func (m *AlertMutation) ResetSourceValue()

ResetSourceValue resets all changes to the "sourceValue" field.

func (*AlertMutation) ResetStartedAt

func (m *AlertMutation) ResetStartedAt()

ResetStartedAt resets all changes to the "startedAt" field.

func (*AlertMutation) ResetStoppedAt

func (m *AlertMutation) ResetStoppedAt()

ResetStoppedAt resets all changes to the "stoppedAt" field.

func (*AlertMutation) ResetUpdatedAt

func (m *AlertMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*AlertMutation) Scenario

func (m *AlertMutation) Scenario() (r string, exists bool)

Scenario returns the value of the "scenario" field in the mutation.

func (*AlertMutation) ScenarioHash

func (m *AlertMutation) ScenarioHash() (r string, exists bool)

ScenarioHash returns the value of the "scenarioHash" field in the mutation.

func (*AlertMutation) ScenarioHashCleared

func (m *AlertMutation) ScenarioHashCleared() bool

ScenarioHashCleared returns if the "scenarioHash" field was cleared in this mutation.

func (*AlertMutation) ScenarioVersion

func (m *AlertMutation) ScenarioVersion() (r string, exists bool)

ScenarioVersion returns the value of the "scenarioVersion" field in the mutation.

func (*AlertMutation) ScenarioVersionCleared

func (m *AlertMutation) ScenarioVersionCleared() bool

ScenarioVersionCleared returns if the "scenarioVersion" field was cleared in this mutation.

func (*AlertMutation) SetBucketId

func (m *AlertMutation) SetBucketId(s string)

SetBucketId sets the "bucketId" field.

func (*AlertMutation) SetCapacity

func (m *AlertMutation) SetCapacity(i int32)

SetCapacity sets the "capacity" field.

func (*AlertMutation) SetCreatedAt

func (m *AlertMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*AlertMutation) SetEventsCount

func (m *AlertMutation) SetEventsCount(i int32)

SetEventsCount sets the "eventsCount" field.

func (*AlertMutation) SetField

func (m *AlertMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*AlertMutation) SetLeakSpeed

func (m *AlertMutation) SetLeakSpeed(s string)

SetLeakSpeed sets the "leakSpeed" field.

func (*AlertMutation) SetMessage

func (m *AlertMutation) SetMessage(s string)

SetMessage sets the "message" field.

func (*AlertMutation) SetOwnerID

func (m *AlertMutation) SetOwnerID(id int)

SetOwnerID sets the "owner" edge to the Machine entity by id.

func (*AlertMutation) SetScenario

func (m *AlertMutation) SetScenario(s string)

SetScenario sets the "scenario" field.

func (*AlertMutation) SetScenarioHash

func (m *AlertMutation) SetScenarioHash(s string)

SetScenarioHash sets the "scenarioHash" field.

func (*AlertMutation) SetScenarioVersion

func (m *AlertMutation) SetScenarioVersion(s string)

SetScenarioVersion sets the "scenarioVersion" field.

func (*AlertMutation) SetSimulated

func (m *AlertMutation) SetSimulated(b bool)

SetSimulated sets the "simulated" field.

func (*AlertMutation) SetSourceAsName

func (m *AlertMutation) SetSourceAsName(s string)

SetSourceAsName sets the "sourceAsName" field.

func (*AlertMutation) SetSourceAsNumber

func (m *AlertMutation) SetSourceAsNumber(s string)

SetSourceAsNumber sets the "sourceAsNumber" field.

func (*AlertMutation) SetSourceCountry

func (m *AlertMutation) SetSourceCountry(s string)

SetSourceCountry sets the "sourceCountry" field.

func (*AlertMutation) SetSourceIp

func (m *AlertMutation) SetSourceIp(s string)

SetSourceIp sets the "sourceIp" field.

func (*AlertMutation) SetSourceLatitude

func (m *AlertMutation) SetSourceLatitude(f float32)

SetSourceLatitude sets the "sourceLatitude" field.

func (*AlertMutation) SetSourceLongitude

func (m *AlertMutation) SetSourceLongitude(f float32)

SetSourceLongitude sets the "sourceLongitude" field.

func (*AlertMutation) SetSourceRange

func (m *AlertMutation) SetSourceRange(s string)

SetSourceRange sets the "sourceRange" field.

func (*AlertMutation) SetSourceScope

func (m *AlertMutation) SetSourceScope(s string)

SetSourceScope sets the "sourceScope" field.

func (*AlertMutation) SetSourceValue

func (m *AlertMutation) SetSourceValue(s string)

SetSourceValue sets the "sourceValue" field.

func (*AlertMutation) SetStartedAt

func (m *AlertMutation) SetStartedAt(t time.Time)

SetStartedAt sets the "startedAt" field.

func (*AlertMutation) SetStoppedAt

func (m *AlertMutation) SetStoppedAt(t time.Time)

SetStoppedAt sets the "stoppedAt" field.

func (*AlertMutation) SetUpdatedAt

func (m *AlertMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*AlertMutation) Simulated

func (m *AlertMutation) Simulated() (r bool, exists bool)

Simulated returns the value of the "simulated" field in the mutation.

func (*AlertMutation) SourceAsName

func (m *AlertMutation) SourceAsName() (r string, exists bool)

SourceAsName returns the value of the "sourceAsName" field in the mutation.

func (*AlertMutation) SourceAsNameCleared

func (m *AlertMutation) SourceAsNameCleared() bool

SourceAsNameCleared returns if the "sourceAsName" field was cleared in this mutation.

func (*AlertMutation) SourceAsNumber

func (m *AlertMutation) SourceAsNumber() (r string, exists bool)

SourceAsNumber returns the value of the "sourceAsNumber" field in the mutation.

func (*AlertMutation) SourceAsNumberCleared

func (m *AlertMutation) SourceAsNumberCleared() bool

SourceAsNumberCleared returns if the "sourceAsNumber" field was cleared in this mutation.

func (*AlertMutation) SourceCountry

func (m *AlertMutation) SourceCountry() (r string, exists bool)

SourceCountry returns the value of the "sourceCountry" field in the mutation.

func (*AlertMutation) SourceCountryCleared

func (m *AlertMutation) SourceCountryCleared() bool

SourceCountryCleared returns if the "sourceCountry" field was cleared in this mutation.

func (*AlertMutation) SourceIp

func (m *AlertMutation) SourceIp() (r string, exists bool)

SourceIp returns the value of the "sourceIp" field in the mutation.

func (*AlertMutation) SourceIpCleared

func (m *AlertMutation) SourceIpCleared() bool

SourceIpCleared returns if the "sourceIp" field was cleared in this mutation.

func (*AlertMutation) SourceLatitude

func (m *AlertMutation) SourceLatitude() (r float32, exists bool)

SourceLatitude returns the value of the "sourceLatitude" field in the mutation.

func (*AlertMutation) SourceLatitudeCleared

func (m *AlertMutation) SourceLatitudeCleared() bool

SourceLatitudeCleared returns if the "sourceLatitude" field was cleared in this mutation.

func (*AlertMutation) SourceLongitude

func (m *AlertMutation) SourceLongitude() (r float32, exists bool)

SourceLongitude returns the value of the "sourceLongitude" field in the mutation.

func (*AlertMutation) SourceLongitudeCleared

func (m *AlertMutation) SourceLongitudeCleared() bool

SourceLongitudeCleared returns if the "sourceLongitude" field was cleared in this mutation.

func (*AlertMutation) SourceRange

func (m *AlertMutation) SourceRange() (r string, exists bool)

SourceRange returns the value of the "sourceRange" field in the mutation.

func (*AlertMutation) SourceRangeCleared

func (m *AlertMutation) SourceRangeCleared() bool

SourceRangeCleared returns if the "sourceRange" field was cleared in this mutation.

func (*AlertMutation) SourceScope

func (m *AlertMutation) SourceScope() (r string, exists bool)

SourceScope returns the value of the "sourceScope" field in the mutation.

func (*AlertMutation) SourceScopeCleared

func (m *AlertMutation) SourceScopeCleared() bool

SourceScopeCleared returns if the "sourceScope" field was cleared in this mutation.

func (*AlertMutation) SourceValue

func (m *AlertMutation) SourceValue() (r string, exists bool)

SourceValue returns the value of the "sourceValue" field in the mutation.

func (*AlertMutation) SourceValueCleared

func (m *AlertMutation) SourceValueCleared() bool

SourceValueCleared returns if the "sourceValue" field was cleared in this mutation.

func (*AlertMutation) StartedAt

func (m *AlertMutation) StartedAt() (r time.Time, exists bool)

StartedAt returns the value of the "startedAt" field in the mutation.

func (*AlertMutation) StartedAtCleared

func (m *AlertMutation) StartedAtCleared() bool

StartedAtCleared returns if the "startedAt" field was cleared in this mutation.

func (*AlertMutation) StoppedAt

func (m *AlertMutation) StoppedAt() (r time.Time, exists bool)

StoppedAt returns the value of the "stoppedAt" field in the mutation.

func (*AlertMutation) StoppedAtCleared

func (m *AlertMutation) StoppedAtCleared() bool

StoppedAtCleared returns if the "stoppedAt" field was cleared in this mutation.

func (AlertMutation) Tx

func (m AlertMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*AlertMutation) Type

func (m *AlertMutation) Type() string

Type returns the node type of this mutation (Alert).

func (*AlertMutation) UpdatedAt

func (m *AlertMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

type AlertQuery

type AlertQuery struct {
	// contains filtered or unexported fields
}

AlertQuery is the builder for querying Alert entities.

func (*AlertQuery) All

func (aq *AlertQuery) All(ctx context.Context) ([]*Alert, error)

All executes the query and returns a list of Alerts.

func (*AlertQuery) AllX

func (aq *AlertQuery) AllX(ctx context.Context) []*Alert

AllX is like All, but panics if an error occurs.

func (*AlertQuery) Clone

func (aq *AlertQuery) Clone() *AlertQuery

Clone returns a duplicate of the AlertQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*AlertQuery) Count

func (aq *AlertQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*AlertQuery) CountX

func (aq *AlertQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*AlertQuery) Exist

func (aq *AlertQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*AlertQuery) ExistX

func (aq *AlertQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*AlertQuery) First

func (aq *AlertQuery) First(ctx context.Context) (*Alert, error)

First returns the first Alert entity from the query. Returns a *NotFoundError when no Alert was found.

func (*AlertQuery) FirstID

func (aq *AlertQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first Alert ID from the query. Returns a *NotFoundError when no Alert ID was found.

func (*AlertQuery) FirstIDX

func (aq *AlertQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*AlertQuery) FirstX

func (aq *AlertQuery) FirstX(ctx context.Context) *Alert

FirstX is like First, but panics if an error occurs.

func (*AlertQuery) GroupBy

func (aq *AlertQuery) GroupBy(field string, fields ...string) *AlertGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Alert.Query().
	GroupBy(alert.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*AlertQuery) IDs

func (aq *AlertQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of Alert IDs.

func (*AlertQuery) IDsX

func (aq *AlertQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*AlertQuery) Limit

func (aq *AlertQuery) Limit(limit int) *AlertQuery

Limit adds a limit step to the query.

func (*AlertQuery) Offset

func (aq *AlertQuery) Offset(offset int) *AlertQuery

Offset adds an offset step to the query.

func (*AlertQuery) Only

func (aq *AlertQuery) Only(ctx context.Context) (*Alert, error)

Only returns a single Alert entity found by the query, ensuring it only returns one. Returns a *NotSingularError when exactly one Alert entity is not found. Returns a *NotFoundError when no Alert entities are found.

func (*AlertQuery) OnlyID

func (aq *AlertQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only Alert ID in the query. Returns a *NotSingularError when exactly one Alert ID is not found. Returns a *NotFoundError when no entities are found.

func (*AlertQuery) OnlyIDX

func (aq *AlertQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*AlertQuery) OnlyX

func (aq *AlertQuery) OnlyX(ctx context.Context) *Alert

OnlyX is like Only, but panics if an error occurs.

func (*AlertQuery) Order

func (aq *AlertQuery) Order(o ...OrderFunc) *AlertQuery

Order adds an order step to the query.

func (*AlertQuery) QueryDecisions

func (aq *AlertQuery) QueryDecisions() *DecisionQuery

QueryDecisions chains the current query on the "decisions" edge.

func (*AlertQuery) QueryEvents

func (aq *AlertQuery) QueryEvents() *EventQuery

QueryEvents chains the current query on the "events" edge.

func (*AlertQuery) QueryMetas

func (aq *AlertQuery) QueryMetas() *MetaQuery

QueryMetas chains the current query on the "metas" edge.

func (*AlertQuery) QueryOwner

func (aq *AlertQuery) QueryOwner() *MachineQuery

QueryOwner chains the current query on the "owner" edge.

func (*AlertQuery) Select

func (aq *AlertQuery) Select(field string, fields ...string) *AlertSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Alert.Query().
	Select(alert.FieldCreatedAt).
	Scan(ctx, &v)

func (*AlertQuery) Where

func (aq *AlertQuery) Where(ps ...predicate.Alert) *AlertQuery

Where adds a new predicate for the AlertQuery builder.

func (*AlertQuery) WithDecisions

func (aq *AlertQuery) WithDecisions(opts ...func(*DecisionQuery)) *AlertQuery

WithDecisions tells the query-builder to eager-load the nodes that are connected to the "decisions" edge. The optional arguments are used to configure the query builder of the edge.

func (*AlertQuery) WithEvents

func (aq *AlertQuery) WithEvents(opts ...func(*EventQuery)) *AlertQuery

WithEvents tells the query-builder to eager-load the nodes that are connected to the "events" edge. The optional arguments are used to configure the query builder of the edge.

func (*AlertQuery) WithMetas

func (aq *AlertQuery) WithMetas(opts ...func(*MetaQuery)) *AlertQuery

WithMetas tells the query-builder to eager-load the nodes that are connected to the "metas" edge. The optional arguments are used to configure the query builder of the edge.

func (*AlertQuery) WithOwner

func (aq *AlertQuery) WithOwner(opts ...func(*MachineQuery)) *AlertQuery

WithOwner tells the query-builder to eager-load the nodes that are connected to the "owner" edge. The optional arguments are used to configure the query builder of the edge.

type AlertSelect

type AlertSelect struct {
	*AlertQuery
	// contains filtered or unexported fields
}

AlertSelect is the builder for selecting fields of Alert entities.

func (*AlertSelect) Bool

func (as *AlertSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*AlertSelect) BoolX