Giter Club home page Giter Club logo

scalaquery-play-iteratees's Introduction

Superceded!

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.

ScalaQueryPlayIteratees

Build Status

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.

News

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.

Summary

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 an Enumerator!
  • 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

Usage

//
// 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.

Adding SBT Dependency

Scala 2.10.x + Play 2.2.x + Slick 2.0.0:

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.

Scala 2.10.x + Play 2.2.x + Slick 1.0.1:

Please see branch 1.0.x.

Scala 2.9.x + Play 2.0.x + ScalaQuery 0.10.0-M1:

Please see branch 0.9.x.

Status

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.

Copyright

See MIT-LICENSE.txt for details.

scalaquery-play-iteratees's People

Contributors

ms-ati avatar ms-tg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scalaquery-play-iteratees's Issues

Apparent jdbc connection leaks on lightly used system

When system is infrequently doing GC, appears to leak JDBC connections, triggering warning from BoneCP, and eventual exhaustion of database connections.

Observed in 0.9.1 (Scala 2.9.2, Play 2.0.8, ScalaQuery 0.10.0-M1.

How to use?

Need to add usage examples and instructions to master README, and also to explain the sample app and the module in their sub-directory README files.

Versioning and compatibility?

Document a versioning policy, and which versions are compatible across the matrix of versions of Scala, Play, and ScalaQuery/Slick.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.