MCPcopy Create free account
hub / github.com/efectn/go-orm-benchmarks / FirstIDX

Method FirstIDX

bench/ent/model_query.go:97–103  ·  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

95
96// FirstIDX is like FirstID, but panics if an error occurs.
97func (mq *ModelQuery) FirstIDX(ctx context.Context) int {
98 id, err := mq.FirstID(ctx)
99 if err != nil && !IsNotFound(err) {
100 panic(err)
101 }
102 return id
103}
104
105// Only returns a single Model entity found by the query, ensuring it only returns one.
106// Returns a *NotSingularError when more than one Model entity is found.

Callers

nothing calls this directly

Calls 2

FirstIDMethod · 0.95
IsNotFoundFunction · 0.85

Tested by

no test coverage detected