def __init__(self, body, parent, row_factory=lambda x: x): """ Object representing the execution of the request on the server. .. warning:: You should typically not call this constructor by yourself, rather use the :meth:`~.Bucket.fts_query` method (or one of its async derivatives). :param params: An :class:`N1QLQuery` object. :param parent: The parent :class:`~.couchbase.bucket.Bucket` object :param row_factory: Callable which accepts the raw dictionary of each row, and can wrap them in a customized class. The default is simply to return the dictionary itself. To actually receive results of the query, iterate over this object. """ self._body = _to_json(body) self._parent = parent self.row_factory = row_factory self.errors = [] self._mres = None self._do_iter = True self.__raw = False self.__meta_received = False
def index_to_rawjson(ix): """ :param ix: dict or IndexInfo object :return: serialized JSON """ if isinstance(ix, N1qlIndex): ix = ix.raw return _to_json(ix)
def encode(self): """ Encodes this state object to a string. This string may be passed to the :meth:`decode` at a later time. The returned object is safe for sending over the network. :return: A serialized string representing the state """ return couchbase._to_json(self._sv)
def __init__(self, body, parent, row_factory=lambda x: x): """ :param str body: serialized JSON string :param Bucket parent: """ self._body = _to_json(body) self._parent = parent self.row_factory = row_factory self.errors = [] self._mres = None self._do_iter = True self.__raw = False self.__meta_received = False