score:0

The definition of method ddl is included in the description of classes TableQueryExtensionMethods and Sequence. It can be found, for example, via Scaladoc's index.

Why does that make sense?

Consider the following code which got myself confused for some time:

import scala.slick.driver.H2Driver.simple._
// [..]
val dict = TableQuery[Dict]
// [..]
// Create the dictionary table and insert some data
dict.ddl.create

First, note that the import in given example is very similar to the one in the question. I just use a different database.

Method ddl is applied to a value of type TableQuery[Dict] although class TableQuery obviously does not contain this method.

Instead, it was shown that class TableQueryExtensionMethods contains this method.

The implementation of class TableQueryExtensionMethods shows that Slick's developers make use of an implicit Conversion from TableQuery to TableQueryExtensionMethods:

 implicit def tableQueryToTableQueryExtensionMethods [T <: Table[_], U](q: Query[T, U, Seq] with TableQuery[T]) 
    = new TableQueryExtensionMethods[T, U](q)

This allows the execution of line

dict.ddl.create

From the example above.


Related Query

More Query from same tag