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

Method Exist

ent/node_query.go:244–254  ·  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

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