Skip to content

Instantly share code, notes, and snippets.

@mepcotterell
Created September 7, 2012 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mepcotterell/3665974 to your computer and use it in GitHub Desktop.
Save mepcotterell/3665974 to your computer and use it in GitHub Desktop.
TypeTags Example for Database Schema
// NOT TESTED YET
import scala.reflect.runtime.universe._
class Schema[T : TypeTag](val attributes: String*) extends Dynamic {
val length = attributes.length
def selectDynamic[A: TypeTag](field: String): A.tpe = null
def updateDynamic[A: TypeTag](field: String)(value: A.tpe) { }
} // Schema
object SchemaTest extends App {
val account = new Schema[(Int, Int, Double)]("id", "userid", "balance")
} // SchemaTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment