MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / First

Method First

app/controlplane/pkg/data/ent/group_query.go:115–124  ·  view source on GitHub ↗

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

(ctx context.Context)

Source from the content-addressed store, hash-verified

113// First returns the first Group entity from the query.
114// Returns a *NotFoundError when no Group was found.
115func (_q *GroupQuery) First(ctx context.Context) (*Group, error) {
116 nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
117 if err != nil {
118 return nil, err
119 }
120 if len(nodes) == 0 {
121 return nil, &NotFoundError{group.Label}
122 }
123 return nodes[0], nil
124}
125
126// FirstX is like First, but panics if an error occurs.
127func (_q *GroupQuery) FirstX(ctx context.Context) *Group {

Callers 1

FirstXMethod · 0.95

Calls 3

LimitMethod · 0.95
setContextOpFunction · 0.85
AllMethod · 0.45

Tested by

no test coverage detected