(ctx context.Context, olderThan time.Time, limit int)
| 739 | } |
| 740 | |
| 741 | func (c *DatabaseCollection) QueryTombstones(ctx context.Context, olderThan time.Time, limit int) (sgbucket.QueryResultIterator, error) { |
| 742 | |
| 743 | // View Query |
| 744 | if c.useViews() { |
| 745 | opts := Body{ |
| 746 | "stale": false, |
| 747 | QueryParamStartKey: 1, |
| 748 | QueryParamEndKey: olderThan.Unix(), |
| 749 | } |
| 750 | if limit != 0 { |
| 751 | opts[QueryParamLimit] = limit |
| 752 | } |
| 753 | return c.dbCtx.ViewQueryWithStats(ctx, c.dataStore, DesignDocSyncHousekeeping(), ViewTombstones, opts) |
| 754 | } |
| 755 | |
| 756 | // N1QL Query |
| 757 | tombstoneQueryStatement := replaceSyncTokensQuery(QueryTombstones.statement, c.UseXattrs()) |
| 758 | tombstoneQueryStatement = replaceIndexTokensQuery(tombstoneQueryStatement, sgIndexes[IndexTombstones], c.UseXattrs(), c.numIndexPartitions()) |
| 759 | if limit != 0 { |
| 760 | tombstoneQueryStatement = fmt.Sprintf("%s LIMIT %d", tombstoneQueryStatement, limit) |
| 761 | } |
| 762 | |
| 763 | params := map[string]interface{}{ |
| 764 | QueryParamOlderThan: olderThan.Unix(), |
| 765 | } |
| 766 | |
| 767 | return N1QLQueryWithStats(ctx, c.dataStore, QueryTypeTombstones, tombstoneQueryStatement, params, base.RequestPlus, QueryTombstones.adhoc, c.dbStats(), c.slowQueryWarningThreshold()) |
| 768 | } |
| 769 | |
| 770 | func changesViewOptions(channelName string, startSeq, endSeq uint64, limit int) map[string]interface{} { |
| 771 | endKey := []interface{}{channelName, endSeq} |
no test coverage detected