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

Method First

ent/dbpackage_query.go:64–73  ·  view source on GitHub ↗

First returns the first DBPackage entity from the query. Returns a *NotFoundError when no DBPackage was found.

(ctx context.Context)

Source from the content-addressed store, hash-verified

62// First returns the first DBPackage entity from the query.
63// Returns a *NotFoundError when no DBPackage was found.
64func (_q *DBPackageQuery) First(ctx context.Context) (*DBPackage, error) {
65 nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
66 if err != nil {
67 return nil, err
68 }
69 if len(nodes) == 0 {
70 return nil, &NotFoundError{dbpackage.Label}
71 }
72 return nodes[0], nil
73}
74
75// FirstX is like First, but panics if an error occurs.
76func (_q *DBPackageQuery) FirstX(ctx context.Context) *DBPackage {

Callers 1

FirstXMethod · 0.95

Calls 3

LimitMethod · 0.95
setContextOpFunction · 0.85
AllMethod · 0.80

Tested by

no test coverage detected