ViewQueryWithStats is a wrapper for gocbBucket.Query that performs additional diagnostic processing (expvars, slow query logging)
(ctx context.Context, dataStore base.DataStore, ddoc string, viewName string, params map[string]interface{})
| 401 | |
| 402 | // ViewQueryWithStats is a wrapper for gocbBucket.Query that performs additional diagnostic processing (expvars, slow query logging) |
| 403 | func (context *DatabaseContext) ViewQueryWithStats(ctx context.Context, dataStore base.DataStore, ddoc string, viewName string, params map[string]interface{}) (results sgbucket.QueryResultIterator, err error) { |
| 404 | |
| 405 | startTime := time.Now() |
| 406 | if threshold := context.Options.SlowQueryWarningThreshold; threshold > 0 { |
| 407 | defer base.SlowQueryLog(ctx, startTime, threshold, "View Query (%s.%s)", ddoc, viewName) |
| 408 | } |
| 409 | |
| 410 | queryStat := context.DbStats.Query(fmt.Sprintf(base.StatViewFormat, ddoc, viewName)) |
| 411 | |
| 412 | viewStore, ok := base.AsViewStore(dataStore) |
| 413 | if !ok { |
| 414 | return results, fmt.Errorf("Datastore does not support views") |
| 415 | } |
| 416 | |
| 417 | results, err = viewStore.ViewQuery(ctx, ddoc, viewName, params) |
| 418 | if err != nil { |
| 419 | queryStat.QueryErrorCount.Add(1) |
| 420 | } |
| 421 | queryStat.QueryCount.Add(1) |
| 422 | queryStat.QueryTime.Add(time.Since(startTime).Nanoseconds()) |
| 423 | |
| 424 | return results, err |
| 425 | } |
| 426 | |
| 427 | // Query to compute the set of channels granted to the specified user via the Sync Function |
| 428 | func (c *DatabaseCollection) QueryAccess(ctx context.Context, username string) (sgbucket.QueryResultIterator, error) { |
no test coverage detected