How to reference a column by name in slick plain SQL?

久未见 提交于 2019-12-12 03:49:44

问题


I would like to use named references instead of positional in GetResult, so that instead of this:

implicit val getCoffeeResult = GetResult(r => Coffee(r.<<, r.<<, r.<<))

i could write something like this:

implicit val getCoffeeResult = GetResult(r => Coffee(r.get("name"), r.get("supID"),r.get("price")))

I can has named result?


回答1:


You can get it through the resultset:

r.rs.getString("name")


来源:https://stackoverflow.com/questions/15452732/how-to-reference-a-column-by-name-in-slick-plain-sql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!