Created
September 7, 2012 12:46
-
-
Save mepcotterell/3665974 to your computer and use it in GitHub Desktop.
TypeTags Example for Database Schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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