Skip to content

Instantly share code, notes, and snippets.

@ys16
Created June 6, 2012 16:58
Show Gist options
  • Save ys16/2883276 to your computer and use it in GitHub Desktop.
Save ys16/2883276 to your computer and use it in GitHub Desktop.
SimpleSql#onのargsについて
case class ParameterValue[A](aValue: A, statementSetter: ToStatement[A]) {
def set(s: java.sql.PreparedStatement, index: Int) = statementSetter.set(s, index, aValue)
}
case class SimpleSql[T](sql: SqlQuery, params: Seq[(String, ParameterValue[_])], defaultParser: RowParser[T]) extends Sql {
def on(args: (Any, ParameterValue[_])*): SimpleSql[T] = this.copy(params = (this.params) ++ args.map {
case (s: Symbol, v) => (s.name, v)
case (k, v) => (k.toString, v)
})
}
@ys16
Copy link
Author

ys16 commented Jun 6, 2012

def on(args: (Any, ParameterValue[Any])*): SimpleSql[T] でも同じですか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment