问题
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