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

Method QueryMetas

pkg/database/ent/alert_query.go:138–157  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

136
137// QueryMetas chains the current query on the "metas" edge.
138func (_q *AlertQuery) QueryMetas() *MetaQuery {
139 query := (&MetaClient{config: _q.config}).Query()
140 query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
141 if err := _q.prepareQuery(ctx); err != nil {
142 return nil, err
143 }
144 selector := _q.sqlQuery(ctx)
145 if err := selector.Err(); err != nil {
146 return nil, err
147 }
148 step := sqlgraph.NewStep(
149 sqlgraph.From(alert.Table, alert.FieldID, selector),
150 sqlgraph.To(meta.Table, meta.FieldID),
151 sqlgraph.Edge(sqlgraph.O2M, false, alert.MetasTable, alert.MetasColumn),
152 )
153 fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
154 return fromU, nil
155 }
156 return query
157}
158
159// First returns the first Alert entity from the query.
160// Returns a *NotFoundError when no Alert 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