(options, fun)
| 8291 | } |
| 8292 | |
| 8293 | function checkQueryParseError(options, fun) { |
| 8294 | const startkeyName = options.descending ? 'endkey' : 'startkey'; |
| 8295 | const endkeyName = options.descending ? 'startkey' : 'endkey'; |
| 8296 | |
| 8297 | if (typeof options[startkeyName] !== 'undefined' && |
| 8298 | typeof options[endkeyName] !== 'undefined' && |
| 8299 | collate(options[startkeyName], options[endkeyName]) > 0) { |
| 8300 | throw new QueryParseError('No rows can match your key range, ' + |
| 8301 | 'reverse your start_key and end_key or set {descending : true}'); |
| 8302 | } else if (fun.reduce && options.reduce !== false) { |
| 8303 | if (options.include_docs) { |
| 8304 | throw new QueryParseError('{include_docs:true} is invalid for reduce'); |
| 8305 | } else if (options.keys && options.keys.length > 1 && |
| 8306 | !options.group && !options.group_level) { |
| 8307 | throw new QueryParseError('Multi-key fetches for reduce views must use ' + |
| 8308 | '{group: true}'); |
| 8309 | } |
| 8310 | } |
| 8311 | for (const optionName of ['group_level', 'limit', 'skip']) { |
| 8312 | const error = checkPositiveInteger(options[optionName]); |
| 8313 | if (error) { |
| 8314 | throw error; |
| 8315 | } |
| 8316 | } |
| 8317 | } |
| 8318 | |
| 8319 | async function httpQuery(db, fun, opts) { |
| 8320 | // List of parameters to add to the PUT request |
no test coverage detected
searching dependent graphs…