Returning AutoInc ID after Insert in Slick 2.0

前端 未结 2 1332
猫巷女王i
猫巷女王i 2020-12-28 15:15

I have looked to the ends of the earth for the answer to this question. There is not much info out there on slick 2.0. Below is my code for my Addresses model, how would I h

相关标签:
2条回答
  • 2020-12-28 15:27

    If you have fields with default values you may try this

    addresses.map(c => (c.city, c.stateName, c.street1)) returning addresses.map(_.id) += (city, stateName, street1)
    
    0 讨论(0)
  • 2020-12-28 15:32

    Try

    (addresses returning addresses.map(_.id)) += (city, stateName, street1, street2, zip)
    

    haven't tested it, but it is shown here

    0 讨论(0)
提交回复
热议问题