(options, fun)
| 8253 | } |
| 8254 | |
| 8255 | function checkQueryParseError(options, fun) { |
| 8256 | const startkeyName = options.descending ? 'endkey' : 'startkey'; |
| 8257 | const endkeyName = options.descending ? 'startkey' : 'endkey'; |
| 8258 | |
| 8259 | if (typeof options[startkeyName] !== 'undefined' && |
| 8260 | typeof options[endkeyName] !== 'undefined' && |
| 8261 | collate(options[startkeyName], options[endkeyName]) > 0) { |
| 8262 | throw new QueryParseError('No rows can match your key range, ' + |
| 8263 | 'reverse your start_key and end_key or set {descending : true}'); |
| 8264 | } else if (fun.reduce && options.reduce !== false) { |
| 8265 | if (options.include_docs) { |
| 8266 | throw new QueryParseError('{include_docs:true} is invalid for reduce'); |
| 8267 | } else if (options.keys && options.keys.length > 1 && |
| 8268 | !options.group && !options.group_level) { |
| 8269 | throw new QueryParseError('Multi-key fetches for reduce views must use ' + |
| 8270 | '{group: true}'); |
| 8271 | } |
| 8272 | } |
| 8273 | for (const optionName of ['group_level', 'limit', 'skip']) { |
| 8274 | const error = checkPositiveInteger(options[optionName]); |
| 8275 | if (error) { |
| 8276 | throw error; |
| 8277 | } |
| 8278 | } |
| 8279 | } |
| 8280 | |
| 8281 | async function httpQuery(db, fun, opts) { |
| 8282 | // List of parameters to add to the PUT request |
no test coverage detected
searching dependent graphs…