MCPcopy Create free account
hub / github.com/an0nfunc/ALHP / FirstID

Method FirstID

ent/dbpackage_query.go:86–96  ·  view source on GitHub ↗

FirstID returns the first DBPackage ID from the query. Returns a *NotFoundError when no DBPackage ID was found.

(ctx context.Context)

Source from the content-addressed store, hash-verified

84// FirstID returns the first DBPackage ID from the query.
85// Returns a *NotFoundError when no DBPackage ID was found.
86func (_q *DBPackageQuery) FirstID(ctx context.Context) (id int, err error) {
87 var ids []int
88 if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
89 return
90 }
91 if len(ids) == 0 {
92 err = &NotFoundError{dbpackage.Label}
93 return
94 }
95 return ids[0], nil
96}
97
98// FirstIDX is like FirstID, but panics if an error occurs.
99func (_q *DBPackageQuery) FirstIDX(ctx context.Context) int {

Callers 2

FirstIDXMethod · 0.95
ExistMethod · 0.95

Calls 3

LimitMethod · 0.95
setContextOpFunction · 0.85
IDsMethod · 0.45

Tested by

no test coverage detected