def filter(self, criteria: Q, offset: int = 0, limit: int = 10, order_by: list = ()):
        """Read the repository and return results as per the filer"""

        if criteria.children:
            items = list(self._filter(criteria, self.conn['data'][self.schema_name]).values())
        else:
            items = list(self.conn['data'][self.schema_name].values())

        # Sort the filtered results based on the order_by clause
        for o_key in order_by:
            reverse = False
            if o_key.startswith('-'):
                reverse = True
                o_key = o_key[1:]
            items = sorted(items, key=itemgetter(o_key), reverse=reverse)

        result = ResultSet(
            offset=offset,
            limit=limit,
            total=len(items),
            items=items[offset: offset + limit])
        return result
def filter ( self , criteria : Q , offset : int = 0 , limit : int = 10 , order_by : list = ( ) ) : if criteria . children : items = list ( self . _filter ( criteria , self . conn [ 'data' ] [ self . schema_name ] ) . values ( ) ) else : items = list ( self . conn [ 'data' ] [ self . schema_name ] . values ( ) ) for o_key in order_by : reverse = False if o_key . startswith ( '-' ) : reverse = True o_key = o_key [ 1 : ] items = sorted ( items , key = itemgetter ( o_key ) , reverse = reverse ) result = ResultSet ( offset = offset , limit = limit , total = len ( items ) , items = items [ offset : offset + limit ] ) return result
Read the repository and return results as per the filer