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

Method QueryChannels

db/query.go:492–505  ·  view source on GitHub ↗

Query to compute the set of documents assigned to the specified channel within the sequence range

(ctx context.Context, channelName string, startSeq uint64, endSeq uint64, limit int, activeOnly bool)

Source from the content-addressed store, hash-verified

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) {
493
494 if c.useViews() {
495 opts := changesViewOptions(channelName, startSeq, endSeq, limit)
496 return c.dbCtx.ViewQueryWithStats(ctx, c.dataStore, DesignDocSyncGateway(), ViewChannels, opts)
497 }
498
499 // N1QL Query
500 // Standard channel index/query doesn't support the star channel. For star channel queries, QueryStarChannel
501 // (which is backed by IndexAllDocs) is used. The QueryStarChannel result schema is a subset of the
502 // QueryChannels result schema (removal handling isn't needed for the star channel).
503 channelQueryStatement, params := c.buildChannelsQuery(channelName, startSeq, endSeq, limit, activeOnly)
504 return N1QLQueryWithStats(ctx, c.dataStore, QueryChannels.name, channelQueryStatement, params, base.RequestPlus, QueryChannels.adhoc, c.dbStats(), c.slowQueryWarningThreshold())
505}
506
507// buildsChannelsQuery constructs the query statement and query parameters for a channels N1QL query. Also used by unit tests to validate
508// query is covering.

Callers 4

QueryResyncMethod · 0.95

Calls 8

useViewsMethod · 0.95
buildChannelsQueryMethod · 0.95
dbStatsMethod · 0.95
changesViewOptionsFunction · 0.85
DesignDocSyncGatewayFunction · 0.85
N1QLQueryWithStatsFunction · 0.85
ViewQueryWithStatsMethod · 0.80

Tested by 2