diff options
author | Stewart Stewart <stewinsalot@gmail.com> | 2017-02-21 17:04:34 -0500 |
---|---|---|
committer | Stewart Stewart <stewinsalot@gmail.com> | 2017-02-21 17:52:45 -0500 |
commit | 49653139b80f9bad87e51aa0c8181fb48b64b15d (patch) | |
tree | 19fcb42200fa12ae46365754a982a05c987207ae /src | |
parent | 931e401a54fc851d2394b6c231a9d5394d23a8cf (diff) | |
download | slick-codegen-plugin-49653139b80f9bad87e51aa0c8181fb48b64b15d.tar.gz slick-codegen-plugin-49653139b80f9bad87e51aa0c8181fb48b64b15d.tar.bz2 slick-codegen-plugin-49653139b80f9bad87e51aa0c8181fb48b64b15d.zip |
use separate trait
Diffstat (limited to 'src')
-rw-r--r-- | src/main/scala/NamespacedCodegen.scala | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/scala/NamespacedCodegen.scala b/src/main/scala/NamespacedCodegen.scala index 5caa98d..095eefb 100644 --- a/src/main/scala/NamespacedCodegen.scala +++ b/src/main/scala/NamespacedCodegen.scala @@ -111,14 +111,22 @@ class Generator(pkg: String, pkg: String, container: String, parentType: Option[String]): String = { + val traitName = container.capitalize + "SchemaDef" s"""|package $pkg |$allImports - |object ${container} extends { + |// AUTO-GENERATED Slick data model + | + |/** Stand-alone Slick data model for immediate use */ + |object $container extends { | val profile = $profile - |} with ${parentType.getOrElse("AnyRef")} { + |} with $traitName + | + |/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */ + |trait $traitName${parentType.fold("")(" extends " + _)} { | import profile.api._ - | ${filteredCode} - |}""".stripMargin + | ${indent(filteredCode)} + |}""".stripMargin.trim() + // TODO: default to upstream packageCode after filteredCode is fixed } override def Table = new Table(_) { table => |