Slick code generator string extension methods.
Slick code generator string extension methods. (Warning: Not unicode-safe, uses String#apply)
Table generator virtual class
Table generator virtual class
Table generator factory.
Table generator factory. Override for customization.
Generates code for the complete model (not wrapped in a package yet)
Generates code for the complete model (not wrapped in a package yet)
Enables DDL Generation.
Enables DDL Generation.
Assemble doc comment with scala code
Assemble doc comment with scala code
Maps database table name to entity case class name
Maps database table name to entity case class name
Wrap the given type into an Option type
Wrap the given type into an Option type
Generates code providing the data model as trait and object in a Scala package
Generates code providing the data model as trait and object in a Scala package
Slick profile that is imported in the generated package (e.g. slick.driver.H2Driver)
Scala package the generated code is placed in
The name of a trait and an object the generated code will be placed in within the specified package.
The parent type of the generated main trait.
The parent type of the generated main trait. This can be overridden in subclasses.
Generates code for a qualified Scala type
Generates code for a qualified Scala type
Words that are reserved keywords in Scala
Words that are reserved keywords in Scala
Existing term member names in Table[_] that do not take parameters
Existing term member names in Table[_] that do not take parameters
Maps database table name to Table class and value name
Maps database table name to Table class and value name
Table code generators.
Table code generators.
Table code generators indexed by db table name.
Table code generators indexed by db table name.
Marks a String as a TermName (e.g.
Marks a String as a TermName (e.g. for escaping scala keywords)
Marks a String as a TypeName (e.g.
Marks a String as a TypeName (e.g. for escaping scala keywords)
Writes given content to a file.
Writes given content to a file. Ensures the file ends with a newline character.
Generates code and writes it to a file.
Generates code and writes it to a file. Creates a folder structure for the given package inside the given srcFolder and places the new file inside or overrides the existing one.
Slick profile that is imported in the generated package (e.g. slick.driver.H2Driver)
target folder, in which the package structure folders are placed
Scala package the generated code is placed in (a subfolder structure will be created within srcFolder)
The name of a trait and an object the generated code will be placed in within the specified package.
Name of the output file, to which the code will be written
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.