What is the right way to work with slick's 3.0.0 streaming results and Postgresql?

前端 未结 2 815
孤街浪徒
孤街浪徒 2021-02-04 08:15

I am trying to figure out how to work with slick streaming. I use slick 3.0.0 with postgres driver

The situation is following: server have to give client sequences of da

2条回答
  •  灰色年华
    2021-02-04 08:39

    The correct way to stream in Slick is as provided in documentation is

    val q = for (c <- coffees) yield c.image
    val a = q.result
    val p1: DatabasePublisher[Blob] = db.stream(a.withStatementParameters(rsType = ResultSetType.ForwardOnly, rsConcurrency = ResultSetConcurrency.ReadOnly, fetchSize = 1000 /*your fetching size*/).transactionally)
    

提交回复
热议问题