I am writing code based on "Asynchronous iterators for large record sets" described at https://github.com/websudos/phantom#partial-select-queries
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import org.joda.time.format.DateTimeFormatter
import com.anomaly42.aml.dao.CassandraConnector
import com.websudos.phantom.CassandraTable
import com.websudos.phantom.Implicits._
object People extends People {
def getPersonByUpdatedAt(from:String, to:String, start: Int, limit: Int) = {
val dtf:DateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ");
val fromDateTime = dtf.parseDateTime(from)
val toDateTime = dtf.parseDateTime(to)
People.select(_.updated_at, _.firstName).allowFiltering.where(_.updated_at gte fromDateTime).and(_.updated_at lte toDateTime).fetchEnumerator().slice(start, limit).collect
}
}
I am using following library dependency:
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"com.websudos" %% "phantom-dsl" % "1.5.4",
many more...
)
But I get following error while compilation:
value slice is not a member of play.api.libs.iteratee.Enumerator[(org.joda.time.DateTime, Option[String])]
What I am trying to do is write a query that brings back next 'limit' number of results starting from 'start', each time getPersonByUpdatedAt() method is called.