MCPcopy Create free account
hub / github.com/crowdsecurity/crowdsec / QueryDecisions

Method QueryDecisions

pkg/database/ent/alert_query.go:94–113  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

92
93// QueryDecisions chains the current query on the "decisions" edge.
94func (_q *AlertQuery) QueryDecisions() *DecisionQuery {
95 query := (&DecisionClient{config: _q.config}).Query()
96 query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
97 if err := _q.prepareQuery(ctx); err != nil {
98 return nil, err
99 }
100 selector := _q.sqlQuery(ctx)
101 if err := selector.Err(); err != nil {
102 return nil, err
103 }
104 step := sqlgraph.NewStep(
105 sqlgraph.From(alert.Table, alert.FieldID, selector),
106 sqlgraph.To(decision.Table, decision.FieldID),
107 sqlgraph.Edge(sqlgraph.O2M, false, alert.DecisionsTable, alert.DecisionsColumn),
108 )
109 fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
110 return fromU, nil
111 }
112 return query
113}
114
115// QueryEvents chains the current query on the "events" edge.
116func (_q *AlertQuery) QueryEvents() *EventQuery {

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