问题
It's Slick 2.0.
I have the following:
mytable
.returning(mytable.map(_.id))
.+=(item)(session)
I'd like the insert not only to return the id
but also the name
field and the lastname
fields. Is it possible in Slick?
回答1:
map
determines what projection of the table is returned, so you can pick the fields you need and pack them in a tuple:
mytable
.returning(mytable.map(t => (t.id, t.name, t.lastname)))
.+=(item)(session)
来源:https://stackoverflow.com/questions/27675813/how-to-return-multiple-values-after-insert