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

Method FindByOrgAndName

app/controlplane/pkg/data/group.go:326–342  ·  view source on GitHub ↗
(ctx context.Context, orgID uuid.UUID, name string)

Source from the content-addressed store, hash-verified

324}
325
326func (g GroupRepo) FindByOrgAndName(ctx context.Context, orgID uuid.UUID, name string) (*biz.Group, error) {
327 ctx, span := otelx.Start(ctx, groupRepoTracer, "GroupRepo.FindByOrgAndName")
328 defer span.End()
329
330 entGroup, err := g.data.DB.Group.Query().
331 Where(group.DeletedAtIsNil(), group.Name(name), group.OrganizationID(orgID)).
332 WithOrganization().
333 Only(ctx)
334 if err != nil {
335 if ent.IsNotFound(err) {
336 return nil, biz.NewErrNotFound("group")
337 }
338 return nil, err
339 }
340
341 return entGroupToBiz(entGroup), nil
342}
343
344// FindGroupMembershipByGroupAndID retrieves a group membership for a specific user in a group.
345func (g GroupRepo) FindGroupMembershipByGroupAndID(ctx context.Context, groupID uuid.UUID, userID uuid.UUID) (*biz.GroupMembership, error) {

Callers

nothing calls this directly

Implementers 1

GroupRepoapp/controlplane/pkg/data/group.go

Calls 11

StartFunction · 0.92
DeletedAtIsNilFunction · 0.92
NameFunction · 0.92
OrganizationIDFunction · 0.92
IsNotFoundFunction · 0.92
NewErrNotFoundFunction · 0.92
entGroupToBizFunction · 0.85
OnlyMethod · 0.45
WithOrganizationMethod · 0.45
WhereMethod · 0.45
QueryMethod · 0.45

Tested by

no test coverage detected