Like this project? it on
Source code for blitzdb.queryset
import abc
[docs]class QuerySet(object):
"""
Stores information about objects returned by a database query and retrieves instances of
these objects if necessary.
:param backend: The backend to use for :py:meth:filter`filtering` etc.
:param cls: The class of the documents stored in the query set.
"""
__metaclass__ = abc.ABCMeta
ASCENDING = 1
DESCENDING = -1
def __init__(self, backend, cls):
"""
Initializes a query set.
"""
self.cls = cls
self.backend = backend
@abc.abstractmethod
@abc.abstractmethod
@abc.abstractmethod
[docs] def filter(self, *args, **kwargs):
"""
Performs a `filter` operation on all documents contained in the query set.
See :py:meth:`blitzdb.backends.base.Backend.filter` for more details.
"""
@abc.abstractmethod
@abc.abstractmethod
[docs] def __ne__(self, other):
"""
Checks if two query sets are unequal.
:param other: The object this query set is compared to.
"""
pass
@abc.abstractmethod
[docs] def __eq__(self, other):
"""
Checks if two query sets are equal. Implement this in your derived query set class.
:param other: The object this query set is compared to.
"""