Packages

  • package root
    Definition Classes
    root
  • package slick
    Definition Classes
    root
  • package codegen

    Code generator / type providers

    Code generator / type providers

    Definition Classes
    slick
  • class SourceCodeGenerator extends AbstractSourceCodeGenerator with OutputHelpers

    A customizable code generator for working with Slick.

    A customizable code generator for working with Slick.

    For usage information please see the corresponding part of the Slick documentation.

    The implementation is structured into a small hierarchy of sub-generators responsible for different fragments of the complete output. The implementation of each sub-generator can be swapped out for a customized one by overriding the corresponding factory method. SourceCodeGenerator contains a factory method Table, which it uses to generate a sub-generator for each table. The sub-generator Table in turn contains sub-generators for Table classes, entity case classes, columns, key, indices, etc. Custom sub-generators can easily be added as well.

    Within the sub-generators the relevant part of the Slick data model can be accessed to drive the code generation.

    Of coures it makes sense to integrate this into your build process.

    Definition Classes
    codegen
  • StringExtensions
  • TableDef

class TableDef extends SourceCodeGenerator.TableDef

Source
SourceCodeGenerator.scala
Linear Supertypes
SourceCodeGenerator.TableDef, SourceCodeGenerator.TableDef, Serializable, Product, Equals, AnyRef, Any
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. TableDef
  2. TableDef
  3. TableDef
  4. Serializable
  5. Product
  6. Equals
  7. AnyRef
  8. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Basic customization now overrides

  1. def hlistEnabled: Boolean

    If HList should be used as a compound type instead of tuples.

    If HList should be used as a compound type instead of tuples. Only if hugeClassEnabled is false.

    Definition Classes
    TableDef
  2. def hugeClassEnabled: Boolean

    Default is true, i.e.

    Default is true, i.e. a case class will be generated even if column.size > 22. Override to false to get the code as before Slick 3.3, i.e. a HList based type will be generated instead.

    Definition Classes
    TableDef

Basic customization overrides

  1. def Column: (model.Column) => ColumnDef

    Column generator factory.

    Column generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  2. def EntityType: EntityType

    Entity case class or type alias generator factory.

    Entity case class or type alias generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  3. def ForeignKey: (model.ForeignKey) => ForeignKeyDef

    ForeignKey generator factory.

    ForeignKey generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  4. def Index: (model.Index) => IndexDef

    Index generator factory.

    Index generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  5. def PlainSqlMapper: PlainSqlMapper

    Plain SQL GetResult mapper generator factory.

    Plain SQL GetResult mapper generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  6. def PrimaryKey: (model.PrimaryKey) => PrimaryKeyDef

    PrimaryKey generator factory.

    PrimaryKey generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  7. def TableClass: TableClass

    Table class generator factory.

    Table class generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  8. def TableValue: TableValue

    Table value generator factory.

    Table value generator factory. Override for customization.

    Definition Classes
    TableDefTableDef
  9. def autoIncLast: Boolean

    Indicates whether auto increment columns should be put last.

    Indicates whether auto increment columns should be put last. Please set to !hlistEnabled for switching this on.

    Definition Classes
    TableDef
  10. def code: Seq[String]

    Generates the complete code for this table and its subordinate generators.

    Generates the complete code for this table and its subordinate generators.

    Definition Classes
    TableDef
  11. def definitions: Seq[Def]

    Definitions to be generated for this table

    Definitions to be generated for this table

    Definition Classes
    TableDef
  12. def extractor: String

    Function that extracts the unmapped values from an entity object

    Function that extracts the unmapped values from an entity object

    Definition Classes
    TableDefTableDef
  13. def factory: String

    Function that constructs an entity object from the unmapped values

    Function that constructs an entity object from the unmapped values

    Definition Classes
    TableDefTableDef
  14. def mappingEnabled: Boolean

    Indicates if this table should be mapped using factory and extractor or not, in which case tuples are used.

    Indicates if this table should be mapped using factory and extractor or not, in which case tuples are used. (Consider overriding EntityType.enabled instead, which affects this, too.) Disabled by default when using hlists.

    Definition Classes
    TableDef
  15. def autoIncLastAsOption: Boolean

    Indicates whether auto increment columns should be put last and made an Option with a None default.

    Indicates whether auto increment columns should be put last and made an Option with a None default. Please set to !hlistEnabled for switching this on.

    Definition Classes
    TableDef
    Annotations
    @deprecated
    Deprecated

    (Since version 3.2.0) Use autoIncLast = true and ColumnDef.asOption = autoInc instead.

Ungrouped

  1. trait Def extends AnyRef

    Common interface for any kind of definition within the generated code

    Common interface for any kind of definition within the generated code

    Definition Classes
    TableDef
  2. trait TermDef extends Def

    Common interface for definitions that define a term (val, def, ...) within the generated code

    Common interface for definitions that define a term (val, def, ...) within the generated code

    Definition Classes
    TableDef
  3. trait TypeDef extends Def

    Common interface for definitions that define a type (class, case class, ...) within the generated code

    Common interface for definitions that define a type (class, case class, ...) within the generated code

    Definition Classes
    TableDef
  4. class ColumnDef extends TableDef.ColumnDef
    Definition Classes
    TableDef
  5. trait EntityTypeDef extends TableDef.EntityTypeDef
    Definition Classes
    TableDef
  6. class ForeignKeyDef extends TableDef.ForeignKeyDef
    Definition Classes
    TableDef
  7. class IndexDef extends TableDef.IndexDef
    Definition Classes
    TableDef
  8. trait PlainSqlMapperDef extends TableDef.PlainSqlMapperDef
    Definition Classes
    TableDef
  9. class PrimaryKeyDef extends TableDef.PrimaryKeyDef
    Definition Classes
    TableDef
  10. trait TableClassDef extends TableDef.TableClassDef
    Definition Classes
    TableDef
  11. trait TableValueDef extends TableDef.TableValueDef
    Definition Classes
    TableDef
  12. type Column = ColumnDef

    Column generator virtual class

    Column generator virtual class

    Definition Classes
    TableDefTableDef
  13. type EntityType = EntityTypeDef

    Entity case class or type alias generator virtual class

    Entity case class or type alias generator virtual class

    Definition Classes
    TableDefTableDef
  14. type ForeignKey = ForeignKeyDef

    Foreign key generator virtual class

    Foreign key generator virtual class

    Definition Classes
    TableDefTableDef
  15. type Index = IndexDef

    Index generator virtual class

    Index generator virtual class

    Definition Classes
    TableDefTableDef
  16. type PlainSqlMapper = PlainSqlMapperDef

    Plain SQL GetResult mapper generator virtual class

    Plain SQL GetResult mapper generator virtual class

    Definition Classes
    TableDefTableDef
  17. type PrimaryKey = PrimaryKeyDef

    Primary key generator virtual class

    Primary key generator virtual class

    Definition Classes
    TableDefTableDef
  18. type TableClass = TableClassDef

    Table class generator virtual class

    Table class generator virtual class

    Definition Classes
    TableDefTableDef
  19. type TableValue = TableValueDef

    Table value generator virtual class

    Table value generator virtual class

    Definition Classes
    TableDefTableDef
  1. final lazy val columns: Seq[Column]

    Column code generators in the desired user-facing order.

    Column code generators in the desired user-facing order.

    Definition Classes
    TableDef
  2. final lazy val columnsByName: Map[String, Column]

    Column code generators indexed by db column name

    Column code generators indexed by db column name

    Definition Classes
    TableDef
  3. final lazy val columnsPositional: IndexedSeq[Column]

    Column code generators in the order they appear in the model.

    Column code generators in the order they appear in the model.

    Definition Classes
    TableDef
  4. def compoundType(types: Seq[String]): String

    Creates a compound type from a given sequence of types.

    Creates a compound type from a given sequence of types. Uses HList if hlistEnabled else tuple.

    Definition Classes
    TableDefTableDef
  5. def compoundValue(values: Seq[String]): String

    Creates a compound value from a given sequence of values.

    Creates a compound value from a given sequence of values. Uses HList if hlistEnabled else tuple.

    Definition Classes
    TableDefTableDef
  6. lazy val desiredColumnOrder: Seq[Int]

    Database column positions in the desired user-facing order.

    Database column positions in the desired user-facing order. Currently just moves the positions of AutoInc columns to the end if autoIncLastAsOption is enabled.

    Definition Classes
    TableDef
  7. final lazy val foreignKeys: Seq[ForeignKey]

    Foreign key code generators

    Foreign key code generators

    Definition Classes
    TableDef
  8. final lazy val indices: Seq[Index]

    Index code generators

    Index code generators

    Definition Classes
    TableDef
  9. final def isMappedToHugeClass: Boolean

    Indicates if table has more than 22 columns but still has to be mapped to a case class.

    Indicates if table has more than 22 columns but still has to be mapped to a case class.

    Definition Classes
    TableDef
  10. val model: model.Table
    Definition Classes
    TableDef
  11. final lazy val primaryKey: Option[PrimaryKey]

    Primary key code generator, if this table has one

    Primary key code generator, if this table has one

    Definition Classes
    TableDef
  12. def productElementNames: Iterator[String]
    Definition Classes
    Product