MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / Exist

Method Exist

ent/entity_query.go:292–302  ·  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

290
291// Exist returns true if the query has elements in the graph.
292func (eq *EntityQuery) Exist(ctx context.Context) (bool, error) {
293 ctx = setContextOp(ctx, eq.ctx, "Exist")
294 switch _, err := eq.FirstID(ctx); {
295 case IsNotFound(err):
296 return false, nil
297 case err != nil:
298 return false, fmt.Errorf("ent: check existence: %w", err)
299 default:
300 return true, nil
301 }
302}
303
304// ExistX is like Exist, but panics if an error occurs.
305func (eq *EntityQuery) 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