MCPcopy Index your code
hub / github.com/crowdsecurity/crowdsec / QueryAlerts

Method QueryAlerts

pkg/database/ent/machine_query.go:65–84  ·  view source on GitHub ↗

QueryAlerts chains the current query on the "alerts" edge.

()

Source from the content-addressed store, hash-verified

63
64// QueryAlerts chains the current query on the "alerts" edge.
65func (_q *MachineQuery) QueryAlerts() *AlertQuery {
66 query := (&AlertClient{config: _q.config}).Query()
67 query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
68 if err := _q.prepareQuery(ctx); err != nil {
69 return nil, err
70 }
71 selector := _q.sqlQuery(ctx)
72 if err := selector.Err(); err != nil {
73 return nil, err
74 }
75 step := sqlgraph.NewStep(
76 sqlgraph.From(machine.Table, machine.FieldID, selector),
77 sqlgraph.To(alert.Table, alert.FieldID),
78 sqlgraph.Edge(sqlgraph.O2M, false, machine.AlertsTable, machine.AlertsColumn),
79 )
80 fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
81 return fromU, nil
82 }
83 return query
84}
85
86// First returns the first Machine entity from the query.
87// Returns a *NotFoundError when no Machine was found.

Callers

nothing calls this directly

Calls 5

prepareQueryMethod · 0.95
sqlQueryMethod · 0.95
ErrMethod · 0.80
DialectMethod · 0.80
QueryMethod · 0.45

Tested by

no test coverage detected