This project has been merged into play-slick in this pull request.
If you are using the current versions of Play and Slick, please head over to the play-slick project, which supercedes this one.
If you are using older versions, please see below.
NOTE: This is master branch for versions 1.1.x, for use with Play 2.2.x and Slick 2.0.x on Scala language 2.10.x.
Go to the 1.0.x branch for use with Play 2.2.x and Slick 1.0.x on Scala language 2.10.x.
Go to the 0.9.x branch for use with Play 2.0.x and ScalaQuery 0.10.0-M1 on Scala language 2.9.x.
There is work going on now to merge this library into the play-slick, see freekh/play-slick#115. Please feel free to comment on that issue if you have suggestions or would like to help.
Easily create a Play 2.2.x Enumerator producing chunked results from any Slick 2.0.x query!
- Stream chunked results from any
Query
as anEnumerator
! - Easily plug into Play 2.2.x streaming, such as Comet
- Underlying database transaction provides read consistency across async chunked reads
- Easy logging callbacks
- Robust error handling
- Well-tested library extracted from production code
//
// Controller
//
def listRecordsViaComet = Action { request =>
val pipeline = Records.enumerateAllInChunksOfTwo &>
Enumeratee.map(toJson(_)) &>
Comet(callback = "parent.cometMessage")
Ok.chunked(pipeline)
}
//
// Model
//
object records extends TableQuery(new Records(_)) {
def mkQuery = for { r <- this } yield r
def enumerateAllInChunksOfTwo =
enumerateScalaQuery(profile, Right(database), mkQuery, maybeChunkSize = Some(2))
}
See the included sample play app for a working example.
The latest published release is 1.1.1. Add dependency to project/Build.scala as: "com.timgroup" %% "scalaquery-play-iteratees" % "1.1.1"
Integration into play-slick coming soon! Please comment on this ticket if you'd like to help.
Please see branch 1.0.x.
Please see branch 0.9.x.
This code is working in production code. Questions and pull requests are welcome. No support is currently planned for Play 2.1.x at this time.
See MIT-LICENSE.txt for details.