Let's say I have a table :
object Suppliers extends Table[(Int, String, String, String)]("SUPPLIERS") { def id = column[Int]("SUP_ID", O.PrimaryKey) def name = column[String]("SUP_NAME") def state = column[String]("STATE") def zip = column[String]("ZIP") def * = id ~ name ~ state ~ zip }
Table database name
You can access the table database name by going to: Suppliers.tableName
This is supported by Scaladoc on AbstractTable .
For example, the above table name is the table SUPPLIERS.
Column Column Names
Viewing AbstractTable , getLinearizedNodes and indexes looked promising. However, column names are not present in string representations.
I assume that * means all columns that usually interest me. * is a MappedProjection that has this signature:
final case class MappedProjection[T, P <: Product]( child: Node, f: (P) β T, g: (T) β Option[P])(proj: Projection[P]) extends ColumnBase[T] with UnaryNode with Product with Serializable
*.getLinearizedNodes contains a huge sequence of numbers, and I realized that at this point I just do a rough check of all the API elements to possibly search for the column names in String.
Has anyone else encountered this problem before, or can someone better understand how MappedProjection works?
scala slick
Meredith
source share