| |
- builtins.object
-
- QueryBuilder
class QueryBuilder(builtins.object) |
|
QueryBuilder - Build a reusable query that can be applied on multiple lists, or appended
by several methods.
If you are going to perform the same filter a bunch of times, use QueryBuilder to save
the cost of constructing the query each time. |
|
Methods defined here:
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- addFilter(self, filterMethod='AND', **kwargs)
- addFilter - Add a filter to this query.
@param filterMethod <str> - The filter method to use (AND or OR), default: 'AND'
@param additional args - Filter arguments. @see QueryableListBase.filter
@raises ValueError if filterMethod is not one of known methods.
- addFilterAnd(self, **kwargs)
- addFilterAnd - Adds an AND filter. Alias for #addFilter(filterMethod=FILTER_METHOD_AND, ...)
@see #addFilter
- addFilterOr(self, **kwargs)
- addFilterOr - Adds an OR filter, Alias for #addFIlter(filterMethod=FILTER_METHOD_OR, .,.)
@see #andFilter
- copy(self)
- copy - Create a copy of this query.
@return <QueryBuilder> - a copy of this query
- execute(self, lst)
- execute - Execute the series of filters, in order, on the provided list.
@param lst <list/ A QueryableList type> - The list to filter. If you already know the types of items within
the list, you can pick a QueryableList implementing class to get faster results. Otherwise, if a list type that does
not extend QueryableListBase is provided, QueryableListMixed will be used (Supports both object-like and dict-like items)
@return - QueryableList of results. If you provided #lst as a QueryableList type already, that same type will be returned.
Otherwise, a QueryableListMixed will be returned.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |