Skip to content

Instantly share code, notes, and snippets.

@jg
Forked from dwins/gist:4207894
Created December 4, 2012 19:43
Show Gist options
  • Save jg/4207915 to your computer and use it in GitHub Desktop.
Save jg/4207915 to your computer and use it in GitHub Desktop.
def fetch[R : Fetchable](s: SQLCursor): R = implicitly[Fetchable[R]].fetch(s)
trait Fetchable[R] {
def fetch(s: SQLCursor): R
}
implicit object IntIsFetchable extends Fetchable[Int] {
def fetch(s: SQLCursor): Int = s.getInt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment