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

Method buildRoleAccessQuery

db/query.go:481–489  ·  view source on GitHub ↗

Builds the query statement for a roleAccess N1QL query.

(username string)

Source from the content-addressed store, hash-verified

479
480// Builds the query statement for a roleAccess N1QL query.
481func (c *DatabaseCollection) buildRoleAccessQuery(username string) string {
482 statement := replaceSyncTokensQuery(QueryRoleAccess.statement, c.UseXattrs())
483
484 // SG usernames don't allow back tick, but guard username in select clause for additional safety
485 username = strings.Replace(username, "`", "``", -1)
486 statement = strings.Replace(statement, QuerySelectUserName, username, -1)
487 statement = replaceIndexTokensQuery(statement, sgIndexes[IndexRoleAccess], c.UseXattrs(), c.numIndexPartitions())
488 return statement
489}
490
491// Query to compute the set of documents assigned to the specified channel within the sequence range
492func (c *DatabaseCollection) QueryChannels(ctx context.Context, channelName string, startSeq uint64, endSeq uint64, limit int, activeOnly bool) (sgbucket.QueryResultIterator, error) {

Callers 2

QueryRoleAccessMethod · 0.95
TestCoveringQueriesFunction · 0.80

Calls 4

UseXattrsMethod · 0.95
numIndexPartitionsMethod · 0.95
replaceSyncTokensQueryFunction · 0.85
replaceIndexTokensQueryFunction · 0.85

Tested by 1

TestCoveringQueriesFunction · 0.64