MCPcopy Index your code
hub / github.com/chainloop-dev/chainloop / First

Method First

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

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

(ctx context.Context)

Source from the content-addressed store, hash-verified

113// First returns the first User entity from the query.
114// Returns a *NotFoundError when no User was found.
115func (_q *UserQuery) First(ctx context.Context) (*User, 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{user.Label}
122 }
123 return nodes[0], nil
124}
125
126// FirstX is like First, but panics if an error occurs.
127func (_q *UserQuery) FirstX(ctx context.Context) *User {

Callers 13

FirstXMethod · 0.95
RevokeMethod · 0.45
latestVersionFunction · 0.45
IsPublicMethod · 0.45
SaveMethod · 0.45
loadMembershipMethod · 0.45
FindByOrgNameAndUserMethod · 0.45
CreateMethod · 0.45
GetBundleMethod · 0.45

Calls 3

LimitMethod · 0.95
setContextOpFunction · 0.85
AllMethod · 0.45

Tested by

no test coverage detected