Calling a string interpolator on a variable in Scala
问题 I am writing some database query helper methods for my classes in Scala. This select method is intended to pluck certain columns from the Product table, specified as a comma-seperated list (String) of the desired columns. I want to be able to call it like this: Product.select("id, title") The following code does not work: def select(columns: String) = { DB.readOnly{ implicit session => sql"select ${columns} from $sqlTable limit 1000".map(row => Product(row)).list.apply() }} But this code (for