MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetRoleIDs

Method GetRoleIDs

db/database.go:1446–1458  ·  view source on GitHub ↗

GetRoleIDs returns IDs of all roles, Includes deleted roles based on given flag It choses which View/Index to use based on combination of useViews and includeDeleted When Views is enabled and includeDeleted is true, ViewPrincipal is used to fetch roles when View is enabled and includeDelete is fals

(ctx context.Context, useViews, includeDeleted bool)

Source from the content-addressed store, hash-verified

1444// when View is enabled and includeDelete is false, ViewRolesExcludeDelete is used
1445// Otherwise RoleIndex is used to fetch roles
1446func (db *DatabaseContext) GetRoleIDs(ctx context.Context, useViews, includeDeleted bool) (roles []string, err error) {
1447 if useViews && includeDeleted {
1448 _, roles, err = db.AllPrincipalIDs(ctx)
1449 } else {
1450 roles, err = db.getRoleIDsUsingIndex(ctx, includeDeleted)
1451 }
1452
1453 if err != nil {
1454 return nil, err
1455 }
1456
1457 return roles, nil
1458}
1459
1460type compactProgressCallbackFunc func(purgedDocCount *int)
1461

Callers 4

getRolesMethod · 0.80
TestGetRoleIDsFunction · 0.80
TestAllPrincipalIDsFunction · 0.80
TestGetRoleIDsFunction · 0.80

Calls 2

AllPrincipalIDsMethod · 0.95
getRoleIDsUsingIndexMethod · 0.95

Tested by 3

TestGetRoleIDsFunction · 0.64
TestAllPrincipalIDsFunction · 0.64
TestGetRoleIDsFunction · 0.64