QueryAlerts chains the current query on the "alerts" edge.
()
| 63 | |
| 64 | // QueryAlerts chains the current query on the "alerts" edge. |
| 65 | func (_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. |
nothing calls this directly
no test coverage detected