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

Method FirstX

ent/entity_query.go:147–153  ·  view source on GitHub ↗

FirstX is like First, but panics if an error occurs.

(ctx context.Context)

Source from the content-addressed store, hash-verified

145
146// FirstX is like First, but panics if an error occurs.
147func (eq *EntityQuery) FirstX(ctx context.Context) *Entity {
148 node, err := eq.First(ctx)
149 if err != nil && !IsNotFound(err) {
150 panic(err)
151 }
152 return node
153}
154
155// FirstID returns the first Entity ID from the query.
156// Returns a *NotFoundError when no Entity ID was found.

Callers

nothing calls this directly

Calls 2

FirstMethod · 0.95
IsNotFoundFunction · 0.85

Tested by

no test coverage detected