Re: [play-framework] ActiveSlick usage in Slick 3, Play 2.5

31 views
Skip to first unread message

Renghen Renghen

unread,
Apr 29, 2016, 1:31:41 AM4/29/16
to play-fr...@googlegroups.com
hi,
you need to execute the query total first,from which u will get a future.

then from this future you do a map or a fold to execute code.

Example


val resultFuture = db.run(total.result)

resultFuture.map { result => 
   result match {
    case j:Int =>
    Redirect("/link").flashing("success" -> j.toString)
    case _ =>
    Redirect("/link").flashing("success" -> "other"
   }
}

On Tue, Apr 26, 2016 at 6:30 PM, Edgars <edgars....@gmail.com> wrote:
Hi,

looked into very promising ActiveSlick library, but cant get it to work.
Sample code:

val total = SomeRepo.count
total
.flatMap {
 
case j:Int =>
   
Redirect("/link").flashing("success" -> j.toString)
 
case _ =>
   
Redirect("/link").flashing("success" -> "other")
}

Error:

type mismatch; found : play.api.mvc.Result required: slick.dbio.DBIOAction[?,?,?]

Has anyone using ActiveSlick? Can't find any up to date examples.

Edgars

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/ddd0e24a-ebd6-41a0-982f-9c6143f51aea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
regards

Renghen
Reply all
Reply to author
Forward
0 new messages