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

Method FirstIDX

ent/entity_query.go:170–176  ·  view source on GitHub ↗

FirstIDX is like FirstID, but panics if an error occurs.

(ctx context.Context)

Source from the content-addressed store, hash-verified

168
169// FirstIDX is like FirstID, but panics if an error occurs.
170func (eq *EntityQuery) FirstIDX(ctx context.Context) int {
171 id, err := eq.FirstID(ctx)
172 if err != nil && !IsNotFound(err) {
173 panic(err)
174 }
175 return id
176}
177
178// Only returns a single Entity entity found by the query, ensuring it only returns one.
179// Returns a *NotSingularError when more than one Entity entity is found.

Callers

nothing calls this directly

Calls 2

FirstIDMethod · 0.95
IsNotFoundFunction · 0.85

Tested by

no test coverage detected