Take the schema of a table and convert it to something a object/package etc...
Take the schema of a table and convert it to something a object/package etc... can actually be named as i.e. a namespace.
When defining your query schema object, this will name the method which produces the query schema.
When defining your query schema object, this will name the method which produces the query schema.
It will be named query
by default so if you are doing Table Stereotyping, be sure
it's something reasonable like (ts) => ts.tableName.snakeToLowerCamel
case class Person(firstName:String, lastName:String, age:Int)
object Person {
// The method will be 'query' by default which is good if you are not stereotyping.
def query = querySchema[Person](...)
}
Now let's take an example where you have a database that has two schemas ALPHA
and BRAVO
,
each with a table called Person and you want to stereotype the two schemas into one table case class.
In this case you have to be sure that memberNamer is something like (ts) => ts.tableName.snakeToLowerCamel
so you'll get a different method for every querySchema.
case class Person(firstName:String, lastName:String, age:Int)
object Person {
// Taking ts.tableName.snakeToLowerCamel will ensure each one has a different name. Otherise
// all of them will be 'query' which will result in a compile error.
def alphaPerson = querySchema[Person]("ALPHA.PERSON", ...)
def bravoPerson = querySchema[Person]("BRAVO.PERSON", ...)
}