scalikejdbc/scalikejdbc — pull request #214 by gakuzzzz (2014-04-05 13:53:44+00:00)
Title: Added type unbinding function into SQLSyntax

now, We can extract user defined type value using `TypeBinder`.
However, `insert` and `update` can not resolve user defined type value.

so, this PR introduces type unbinding mechanism as follows.

```scala
case class Account(id: AccountId, name: Name)
object Account extends SQLSyntuxSupport[Account]
case class AccountId(value: Int)
object AccountId {
implicit val typeBinder: TypeBinder[AccountId] = TypeBinder.int.map(AccountId.apply)
implicit val typeUnbinder: TypeUnbinder[AccountId] = TypeUnbinder.int.map(_.value)
}
case class Name(value: String)
object Name {
implicit val typeBinder: TypeBinder[Name] = TypeBinder.string.map(Name.apply)
implicit val typeUnbinder: TypeUnbinder[Name] = TypeUnbinder.string.map(_.value)
}
```

```scala
insert.into(Account).namedValues(ac.id --> AccountId(4), ac.name --> Name("Debian"))
update(Account).set(ac.name --> Name("Bob")).where.eq(ac.id, 2)
```

**grave concern**

this PR dont make QueryBuilder's method typesafe.

```scala
select.from(Account as a).where.eq(a.id, AccountId(2)) // It can not do!
```