Slick experts
I'm learning and playing with Slick, and I have question: the document says the Compiled Query only works for select, update and delete, http://slick.typesafe.com/doc/2.0.0/queries.html#compiled-queries
I'm curious why it does not support insert? Does it mean everytime I have to insert a row in the table, the statement needs to be re-compiled by Slick? Is there any way to compile an insert statement? Thanks!
The documentation should be clearer here. For inserts you would cache the insert invoker instead.
val i = someQuery.insertInvoker
i.insert( foo )
i.insert( bar )
The query is only compiled once.
I created a pull request to improve our documentation on this point: https://github.com/slick/slick/pull/629
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With