Skip to content

Instantly share code, notes, and snippets.

@gakuzzzz
Created July 24, 2015 06:35
Show Gist options
  • Save gakuzzzz/38fa8ce77eb4000a05c1 to your computer and use it in GitHub Desktop.
Save gakuzzzz/38fa8ce77eb4000a05c1 to your computer and use it in GitHub Desktop.
ぶんかつ
import enumlike.{EnumCompanionBase, EnumLike}
import scalikejdbc._
trait ScalikeJDBCEnumCompanion {
self: EnumCompanionBase =>
implicit def optionalTypeBinder(implicit ev: TypeBinder[EnumLikeType#ValueType]): TypeBinder[Option[A]] = ev.map(valueOf)
implicit def typeBinder(implicit ev: TypeBinder[EnumLikeType#ValueType]): TypeBinder[A] = optionalTypeBinder(ev).map(_.get)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment