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

Method Exist

pkg/database/ent/machine_query.go:245–255  ·  view source on GitHub ↗

Exist returns true if the query has elements in the graph.

(ctx context.Context)

Source from the content-addressed store, hash-verified

243
244// Exist returns true if the query has elements in the graph.
245func (_q *MachineQuery) Exist(ctx context.Context) (bool, error) {
246 ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
247 switch _, err := _q.FirstID(ctx); {
248 case IsNotFound(err):
249 return false, nil
250 case err != nil:
251 return false, fmt.Errorf("ent: check existence: %w", err)
252 default:
253 return true, nil
254 }
255}
256
257// ExistX is like Exist, but panics if an error occurs.
258func (_q *MachineQuery) ExistX(ctx context.Context) bool {

Callers 1

ExistXMethod · 0.95

Calls 3

FirstIDMethod · 0.95
setContextOpFunction · 0.85
IsNotFoundFunction · 0.85

Tested by

no test coverage detected