How are reactive streams used in Slick for inserting data

后端 未结 3 467
挽巷
挽巷 2020-12-16 02:18

In Slick\'s documentation examples for using Reactive Streams are presented just for reading data as a means of a DatabasePublisher. But what happens when you want to use yo

3条回答
  •  眼角桃花
    2020-12-16 02:27

    I find Alpakka's documentation to be excellent and it's DSL to be really easy to work with reactive streams.

    This is the docs for Slick: https://doc.akka.io/docs/alpakka/current/slick.html

    Inserting example:

    Source(0 to 100)
        .runWith(
          // add an optional first argument to specify the parallelism factor (Int)
          Slick.sink(value => sqlu"INSERT INTO NumberTable VALUES(${value})")
        )
    

提交回复
热议问题