GenerationRules

slick.additions.codegen.GenerationRules

Generates TableConfigs (and their ColumnConfigs by reading database metadata. Extend this trait directly or indirectly, and override methods freely to customize.

The default implementation does not generate code that requires slick-additions, uses camelCase for corresponding snake_case names in the database, and names model classes by appending Row to the camel-cased table name.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def container: String
def packageName: String

Concrete methods

def baseColumnDefault(currentTableMetadata: TableMetadata, all: Seq[TableMetadata]): PartialFunction[MColumn, Term]

Determine the base Scala default value for a column. If the columns is nullable, the expression returned from this method will be wrapped in Some(...).

Determine the base Scala default value for a column. If the columns is nullable, the expression returned from this method will be wrapped in Some(...).

Extend by overriding with orElse.

Attributes

See also
Example
 override def baseColumnDefault(current: TableMetadata, all: Seq[TableMetadata]) =
 super.baseColumnDefault(current, all).orElse { case ... } 
def baseColumnType(currentTableMetadata: TableMetadata, all: Seq[TableMetadata]): PartialFunction[MColumn, Type]

Determine the base Scala type for a column. If the column is nullable, the type returned from this method will be wrapped in Option[...].

Determine the base Scala type for a column. If the column is nullable, the type returned from this method will be wrapped in Option[...].

Extend by overriding with orElse.

Attributes

See also
Example
 override def baseColumnType(current: TableMetadata, all: Seq[TableMetadata]) = super.baseColumnType(current,
 all).orElse { case ... } 
def columnConfig(column: MColumn, currentTableMetadata: TableMetadata, all: Seq[TableMetadata]): ColumnConfig
def columnConfigs(currentTableMetadata: TableMetadata, all: Seq[TableMetadata]): List[ColumnConfig]
def columnNameToIdentifier(name: String): String
def extraImports: List[String]
def filePath(base: Path): Path
def includeTable(table: MTable): Boolean
def modelClassName(tableName: MQName): String
def tableConfig(currentTableMetadata: TableMetadata, all: Seq[TableMetadata]): TableConfig
def tableConfigs(slickProfileClass: Class[_ <: JdbcProfile])(implicit ec: ExecutionContext): DBIO[List[TableConfig]]
def tableNameToIdentifier(name: MQName): String