trait OutputHelpers extends AnyRef
Output-related code-generation utilities.
- Source
- OutputHelpers.scala
- Grouped
- Alphabetic
- By Inheritance
- OutputHelpers
- AnyRef
- Any
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Basic customization overrides
- def packageCode(profile: String, pkg: String, container: String, parentType: Option[String]): String
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
- profile
Slick profile that is imported in the generated package (e.g. slick.jdbc.H2Profile)
- pkg
Scala package the generated code is placed in
- container
The name of a trait and an object the generated code will be placed in within the specified package.
- def packageContainerCode(profile: String, pkg: String, container: String = "Tables"): String
Generates code providing the stand-alone slick data model for immediate use.
Generates code providing the stand-alone slick data model for immediate use.
- profile
Slick profile that is imported in the generated package (e.g. scala.slick.driver.H2Driver)
- pkg
Scala package the generated code is placed in
- container
The name of a trait and an object the generated code will be placed in within the specified package.
- def packageTableCode(tableName: String, tableCode: String, pkg: String, container: String): String
Generates code for the given table.
Generates code for the given table. The tableName and tableCode parameters should come from the #codePerTable map.
- tableName
: the name of the table
- tableCode
: the generated code for the table.
- pkg
Scala package the generated code is placed in
- container
The name of the container
Output
- def writeStringToFile(content: String, folder: String, pkg: String, fileName: String): Unit
Writes given content to a file.
Writes given content to a file. Ensures the file ends with a newline character.
- def writeToFile(profile: String, folder: String, pkg: String, container: String = "Tables", fileName: String = "Tables.scala"): Unit
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.
- profile
Slick profile that is imported in the generated package (e.g. slick.jdbc.H2Profile)
- folder
target folder, in which the package structure folders are placed
- pkg
Scala package the generated code is placed in (a subfolder structure will be created within srcFolder)
- container
The name of a trait and an object the generated code will be placed in within the specified package.
- fileName
Name of the output file, to which the code will be written
- def writeToMultipleFiles(profile: String, folder: String, pkg: String, container: String = "Tables"): Unit
Generates code and writes it to multiple files.
Generates code and writes it to multiple files. Creates a folder structure for the given package inside the given srcFolder and places the new files inside or overrides the existing one.
- profile
Slick profile that is imported in the generated package (e.g. scala.slick.driver.H2Driver)
- folder
target folder, in which the output files are placed
- pkg
Scala package the generated code is placed in (a subfolder structure will be created within srcFolder)
- container
The name of a trait and an object the generated code will be placed in within the specified package.
Ungrouped
- abstract def code: String
- abstract def codeForContainer: String
The generated code used to generate the container class.
- abstract def codePerTable: Map[String, String]
The generated code stored in a map that associates the scala filename with the generated code (this map contains one entry per table).
- abstract def foreignKeysPerTable: Map[String, List[String]]
Foreign keys used for mapping a minimal set of dependencies between tables.
- abstract def indent(code: String): String
Indents all but the first line of the given string No indent is added to empty lines.
- def parentType: Option[String]
The parent type of the generated main trait.
The parent type of the generated main trait. This can be overridden in subclasses.
- def rootTraitCode(profile: String, pkg: String, container: String = "Tables"): String