diff options
-rw-r--r-- | src/main/scala/NamespacedCodegen.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/scala/NamespacedCodegen.scala b/src/main/scala/NamespacedCodegen.scala index 651094b..9c6d126 100644 --- a/src/main/scala/NamespacedCodegen.scala +++ b/src/main/scala/NamespacedCodegen.scala @@ -90,8 +90,9 @@ class Generator(uri: URI, pkg: String, dbModel: Model, outputPath: String, manua | // TODO: the name for this implicit should be changed in driver core | implicit val tColType = MappedColumnType.base[com.drivergrp.core.time.Time, Long](time => time.millis, com.drivergrp.core.time.Time(_)) | ${tableCode} + | |} - """.stripMargin + |// scalastyle:on""".stripMargin writeStringToFile( packageName + allImports + generatedSchema, @@ -110,7 +111,7 @@ class Generator(uri: URI, pkg: String, dbModel: Model, outputPath: String, manua override def Table = new Table(_) { table => // need this in order to use our own TableClass generator - override def definitions = Seq[Def]( EntityType, PlainSqlMapper, TableClassRef, TableValue ) + override def definitions = Seq[Def]( EntityTypeRef, PlainSqlMapper, TableClassRef, TableValue ) def TableClassRef = new TableClass() { // We disable the option mapping, as it is a bit more complex to support and we don't appear to need it @@ -139,6 +140,10 @@ class Generator(uri: URI, pkg: String, dbModel: Model, outputPath: String, manua else s"(a : ${TableClass.elementType}) => Some(" + columns.map("a."+_.name ).mkString("::") + ":: HNil)" + def EntityTypeRef = new EntityTypeDef { + override def code: String = (if (classEnabled) "final " else "") + super.code + } + override def Column = new Column(_) { column => |