我正在编写基于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
}
}
我正在使用以下库依赖项:
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"com.websudos" %% "phantom-dsl" % "1.5.4",
many more...
)
但是编译时出现以下错误:
value slice is not a member of play.api.libs.iteratee.Enumerator[(org.joda.time.DateTime, Option[String])]
我想要做的是编写一个查询,每次调用 getPersonByUpdatedAt() 方法时,从“开始”开始返回下一个“限制”结果数。