public function test_compareTimelinesWithQuery() { $from = UTCTime::getUTCTimestamp(0); $timeline = []; // step is 3 seconds $rql = "and(or(eq(seconds,"; for ($i = 0; $i < 15; $i += 3) { $dateInfo = $this->object->read($from + $i); $timeline[] = $dateInfo; $rql .= $dateInfo['seconds']; $rql .= "),eq(seconds,"; } $rql = rtrim($rql, "),eq(seconds,") . ")),ge(timestamp," . $from . "))&limit(5,0)"; $rqlQueryObject = $this->rqlParser->rqlDecoder($rql); $timelineDsRows = $this->object->query($rqlQueryObject); $this->assertEquals($timeline, $timelineDsRows); }
/** * Translates the "query" call to DataStore * * @see \zaboy\scheduler\Callback\Factory\DataStoreAbstractFactory * @see \zaboy\rest\DataStore\Interfaces\DataStoresInterface * @param array $options * @return array | \zaboy\rest\DataStore\Interfaces\DataStoresInterface array * @throws CallbackException */ private function query(array $options = []) { $itemData = $options['item_data']; if (!isset($itemData['query'])) { throw new CallbackException("Expected necessary parameter \"query\" in the options array"); } $parser = new RqlParser(); $query = $parser->rqlDecoder($itemData['query']); return $this->dataStore->query($query); }