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
  • AbstractSourceCodeTableDef
  • AbstractTableDef
  • SourceCodeTableDef
  • StringExtensions

class SourceCodeTableDef extends AbstractSourceCodeTableDef

Source
SourceCodeGenerator.scala
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. SourceCodeTableDef
  2. AbstractSourceCodeTableDef
  3. AbstractTableDef
  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

Instance Constructors

  1. new SourceCodeTableDef(model: model.Table)

Type Members

  1. abstract case class AbstractColumnDef(model: model.Column) extends AbstractTermDef with Product with Serializable

    Column related generator definition

    Column related generator definition

    model

    corresponding Slick meta model component

    Definition Classes
    AbstractTableDef
  2. trait AbstractDef 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
    AbstractTableDef
  3. trait AbstractEntityTypeDef extends AbstractTypeDef

    Entity case class or type alias generator definition (Mapped case class holding a complete row of data of this table).

    Entity case class or type alias generator definition (Mapped case class holding a complete row of data of this table).

    Definition Classes
    AbstractTableDef
  4. abstract case class AbstractForeignKeyDef(model: model.ForeignKey) extends AbstractTermDef with Product with Serializable

    ForeignKey related generator definition

    ForeignKey related generator definition

    model

    corresponding Slick meta model component

    Definition Classes
    AbstractTableDef
  5. abstract case class AbstractIndexDef(model: model.Index) extends AbstractTermDef with Product with Serializable

    Index related generator definition

    Index related generator definition

    model

    corresponding Slick meta model component

    Definition Classes
    AbstractTableDef
  6. trait AbstractPlainSqlMapperDef extends AbstractTermDef

    Plain SQL GetResult mapper generator definition

    Plain SQL GetResult mapper generator definition

    Definition Classes
    AbstractTableDef
  7. abstract case class AbstractPrimaryKeyDef(model: model.PrimaryKey) extends AbstractTermDef with Product with Serializable

    PrimaryKey related generator definition (Currently only used for composite primary keys.)

    PrimaryKey related generator definition (Currently only used for composite primary keys.)

    model

    corresponding Slick meta model component

    Definition Classes
    AbstractTableDef
  8. trait AbstractTableClassDef extends AbstractTypeDef

    Table class generator definition

    Table class generator definition

    Definition Classes
    AbstractTableDef
  9. trait AbstractTableValueDef extends AbstractTermDef

    Table value generator definition (generates a collection-like value representing this database table).

    Table value generator definition (generates a collection-like value representing this database table).

    Definition Classes
    AbstractTableDef
  10. trait AbstractTermDef extends AbstractDef

    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
    AbstractTableDef
  11. trait AbstractTypeDef extends AbstractDef

    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
    AbstractTableDef
  12. class AbstractSourceCodeColumnDef extends AbstractColumnDef
    Definition Classes
    AbstractSourceCodeTableDef
  13. trait AbstractSourceCodeEntityTypeDef extends AbstractEntityTypeDef
    Definition Classes
    AbstractSourceCodeTableDef
  14. class AbstractSourceCodeForeignKeyDef extends AbstractForeignKeyDef
    Definition Classes
    AbstractSourceCodeTableDef
  15. class AbstractSourceCodeIndexDef extends AbstractIndexDef
    Definition Classes
    AbstractSourceCodeTableDef
  16. trait AbstractSourceCodePlainSqlMapperDef extends AbstractPlainSqlMapperDef
    Definition Classes
    AbstractSourceCodeTableDef
  17. class AbstractSourceCodePrimaryKeyDef extends AbstractPrimaryKeyDef
    Definition Classes
    AbstractSourceCodeTableDef
  18. trait AbstractSourceCodeTableClassDef extends AbstractTableClassDef
    Definition Classes
    AbstractSourceCodeTableDef
  19. trait AbstractSourceCodeTableValueDef extends AbstractTableValueDef
    Definition Classes
    AbstractSourceCodeTableDef
  20. type Column = AbstractSourceCodeColumnDef

    Column generator virtual class

    Column generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  21. type EntityType = AbstractSourceCodeEntityTypeDef

    Entity case class or type alias generator virtual class

    Entity case class or type alias generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  22. type ForeignKey = AbstractSourceCodeForeignKeyDef

    Foreign key generator virtual class

    Foreign key generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  23. type Index = AbstractSourceCodeIndexDef

    Index generator virtual class

    Index generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  24. type PlainSqlMapper = AbstractSourceCodePlainSqlMapperDef

    Plain SQL GetResult mapper generator virtual class

    Plain SQL GetResult mapper generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  25. type PrimaryKey = AbstractSourceCodePrimaryKeyDef

    Primary key generator virtual class

    Primary key generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  26. type TableClass = AbstractSourceCodeTableClassDef

    Table class generator virtual class

    Table class generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  27. type TableValue = AbstractSourceCodeTableValueDef

    Table value generator virtual class

    Table value generator virtual class

    Definition Classes
    SourceCodeTableDefAbstractTableDef

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toany2stringadd[SourceCodeTableDef] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (SourceCodeTableDef, B)
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toArrowAssoc[SourceCodeTableDef] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def Column: (model.Column) => AbstractSourceCodeColumnDef

    Column generator factory.

    Column generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  7. def EntityType: EntityType

    Entity case class or type alias generator factory.

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

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  8. def ForeignKey: (model.ForeignKey) => AbstractSourceCodeForeignKeyDef

    ForeignKey generator factory.

    ForeignKey generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  9. def Index: (model.Index) => AbstractSourceCodeIndexDef

    Index generator factory.

    Index generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  10. def PlainSqlMapper: PlainSqlMapper

    Plain SQL GetResult mapper generator factory.

    Plain SQL GetResult mapper generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  11. def PrimaryKey: (model.PrimaryKey) => AbstractSourceCodePrimaryKeyDef

    PrimaryKey generator factory.

    PrimaryKey generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  12. def TableClass: TableClass

    Table class generator factory.

    Table class generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  13. def TableValue: TableValue

    Table value generator factory.

    Table value generator factory. Override for customization.

    Definition Classes
    SourceCodeTableDefAbstractTableDef
  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. 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
    AbstractTableDef
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
  17. 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
    AbstractTableDef
  18. 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
    AbstractTableDef
  19. 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
    AbstractTableDef
  20. 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
    AbstractTableDef
  21. 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
    AbstractSourceCodeTableDefAbstractTableDef
  22. 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
    AbstractSourceCodeTableDefAbstractTableDef
  23. def definitions: Seq[AbstractDef]

    Definitions to be generated for this table

    Definitions to be generated for this table

    Definition Classes
    AbstractTableDef
  24. 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
    AbstractTableDef
  25. def ensuring(cond: (SourceCodeTableDef) => Boolean, msg: => Any): SourceCodeTableDef
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toEnsuring[SourceCodeTableDef] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  26. def ensuring(cond: (SourceCodeTableDef) => Boolean): SourceCodeTableDef
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toEnsuring[SourceCodeTableDef] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  27. def ensuring(cond: Boolean, msg: => Any): SourceCodeTableDef
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toEnsuring[SourceCodeTableDef] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  28. def ensuring(cond: Boolean): SourceCodeTableDef
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toEnsuring[SourceCodeTableDef] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  29. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. 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
    AbstractSourceCodeTableDefAbstractTableDef
  31. final lazy val foreignKeys: Seq[ForeignKey]

    Foreign key code generators

    Foreign key code generators

    Definition Classes
    AbstractTableDef
  32. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  33. 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
    AbstractTableDef
  34. 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
    AbstractTableDef
  35. final lazy val indices: Seq[Index]

    Index code generators

    Index code generators

    Definition Classes
    AbstractTableDef
  36. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  37. 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
    AbstractTableDef
  38. 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
    AbstractTableDef
  39. val model: model.Table
    Definition Classes
    AbstractTableDef
  40. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  41. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  42. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @native()
  43. 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
    AbstractTableDef
  44. def productElementNames: Iterator[String]
    Definition Classes
    Product
  45. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  46. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  47. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  48. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toStringFormat[SourceCodeTableDef] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (SourceCodeTableDef, B)
    Implicit
    This member is added by an implicit conversion from SourceCodeTableDef toArrowAssoc[SourceCodeTableDef] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromSourceCodeTableDef to any2stringadd[SourceCodeTableDef]

Inherited by implicit conversion StringFormat fromSourceCodeTableDef to StringFormat[SourceCodeTableDef]

Inherited by implicit conversion Ensuring fromSourceCodeTableDef to Ensuring[SourceCodeTableDef]

Inherited by implicit conversion ArrowAssoc fromSourceCodeTableDef to ArrowAssoc[SourceCodeTableDef]

Basic customization now overrides

Basic customization overrides

Ungrouped