Mercurial > p > roundup > code
comparison doc/design.txt @ 5869:16e1255b16cf
Implement limit and offset for filter
These map to the corresponding SQL parameters for the SQL backends.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Mon, 26 Aug 2019 20:23:53 +0200 |
| parents | ee2e8f8d6648 |
| children | de9d602c8ce6 |
comparison
equal
deleted
inserted
replaced
| 5868:d2fac1069028 | 5869:16e1255b16cf |
|---|---|
| 514 db.issue.find(messages='1') | 514 db.issue.find(messages='1') |
| 515 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) | 515 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) |
| 516 """ | 516 """ |
| 517 | 517 |
| 518 def filter(self, search_matches, filterspec, sort, group, | 518 def filter(self, search_matches, filterspec, sort, group, |
| 519 retired, exact_match_spec): | 519 retired, exact_match_spec, limit, offset): |
| 520 """Return a list of the ids of the active nodes in this class that | 520 """Return a list of the ids of the active nodes in this class that |
| 521 match the 'filter' spec, sorted by the group spec and then the | 521 match the 'filter' spec, sorted by the group spec and then the |
| 522 sort spec. The arguments sort, group, retired, and | 522 sort spec. The arguments sort, group, retired, and |
| 523 exact_match_spec are optional. | 523 exact_match_spec are optional. |
| 524 | 524 |
| 541 The parameter retired when set to False, returns only live | 541 The parameter retired when set to False, returns only live |
| 542 (un-retired) results. When setting it to True, only retired | 542 (un-retired) results. When setting it to True, only retired |
| 543 items are returned. If None, both retired and unretired | 543 items are returned. If None, both retired and unretired |
| 544 items are returned. The default is False, i.e. only live | 544 items are returned. The default is False, i.e. only live |
| 545 items are returned by default. | 545 items are returned by default. |
| 546 | |
| 547 The "limit" and "offset" parameters define a limit on the | |
| 548 number of results returned and an offset before returning | |
| 549 any results, respectively. These can be used when displaying | |
| 550 a number of items in a pagination application or similar. A | |
| 551 common use-case is returning the first item of a sorted | |
| 552 search by specifying limit=1 (i.e. the maximum or minimum | |
| 553 depending on sort order). | |
| 546 | 554 |
| 547 The filter must match all properties specificed. If the property | 555 The filter must match all properties specificed. If the property |
| 548 value to match is a list: | 556 value to match is a list: |
| 549 | 557 |
| 550 1. String properties must match all elements in the list, and | 558 1. String properties must match all elements in the list, and |
