MCPcopy
hub / github.com/crowdsecurity/crowdsec / QueryAlerts

Method QueryAlerts

pkg/database/ent/client.go:1591–1604  ·  view source on GitHub ↗

QueryAlerts queries the alerts edge of a Machine.

(_m *Machine)

Source from the content-addressed store, hash-verified

1589
1590// QueryAlerts queries the alerts edge of a Machine.
1591func (c *MachineClient) QueryAlerts(_m *Machine) *AlertQuery {
1592 query := (&AlertClient{config: c.config}).Query()
1593 query.path = func(context.Context) (fromV *sql.Selector, _ error) {
1594 id := _m.ID
1595 step := sqlgraph.NewStep(
1596 sqlgraph.From(machine.Table, machine.FieldID, id),
1597 sqlgraph.To(alert.Table, alert.FieldID),
1598 sqlgraph.Edge(sqlgraph.O2M, false, machine.AlertsTable, machine.AlertsColumn),
1599 )
1600 fromV = sqlgraph.Neighbors(_m.driver.Dialect(), step)
1601 return fromV, nil
1602 }
1603 return query
1604}
1605
1606// Hooks returns the client hooks.
1607func (c *MachineClient) Hooks() []Hook {

Callers

nothing calls this directly

Calls 2

DialectMethod · 0.80
QueryMethod · 0.45

Tested by

no test coverage detected