Scweery 是 Scala 一个封装了 JDBC 操作用来从 SQL 中创建 Scala 对象的工具包。
示例代码:
using(petsDB) { connection => val findHogsQuery = "select name, gender from pets where family='erinaceidae' order by cuteness" val listOfHedgehogs = connection.inferListOf[Hedgehog](findHogsQuery) { row => new Hedgehog(row.string("name"), row.string("gender")) } listOfHedgehogs.foreach(_.hug) }