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