Scala Play Framework 2.1 Slick 1.0 Cake Pattern Common Table Fields -
I am working on a project that uses Slim 1.0 and the cake to connect to a PostGrascul database Pattern All right, everything looks fine, but I have a lot of applause and I think that there are many common columns which are in all tables I would like to be able to create an attribute in the common field, but I do not understand this Coming out how it works. (I am fairly new in Scala, but I think the basics below are well below.)
Here's an example that expects what I want to do:
one .scala:
package models.db.slick import java.util.UUID import play.api.db.slick.Profile case class one (normal 1: uuid, normal2 : String, exclusive 1: string) attribute OneComponent {it: profile = & gt; Increase the table [one] ("one") with the import object.simple._ object object commoncolor {DRF exclusive 1 = column [string] ("exclusive 1") df * = common 1 ~ common 2 ~ exclusive 1 ; & Gt; (One.apply _, One.unapply _)}} column column. Scala:
package model. Db.slick import java.util.UUID Import play.api.db.slick.Profile trait CommonColumns {def common1 = column [UUID] ("normal 1" ) Def general 2 = column [string] ("mango2")} does not compile because the columns in columns column do not know [T]. I tried to specify a self-type table, but I can not understand how to get a table object that is in Scala. Script doctor. BaskatablesCompanyent Attribution I also tried to specify a self type which implements a column function:
attribute general column {this => {DEEF COLUMN [C] (N: String, Options: ScalaLeck Lift, Column Option [C] *) (Built-in TM: Scala Lilik Lift. Tape Mapper [C]): Scala. Lily the lift. Column [c]} ...} but it does not work I most likely have a syntax on it, but I can not find a good example of doing this. is.
What do you think? Is there a good way to do this?
I understood it! At least I think I did if someone sees something wrong with this, so please let me know.
OK, so here's how I did it:
I changed the properties of the normal column: > attribute general Callcontent {it: profile = & gt; Import profile. Simple._type general column {it: table [_] = & gt; DF Common 1 = Column [UUID] ("General 1") DIF Normal 2 = Column [String] ("Common 2")} And then I changed the same OneComponent to :
attribute OneComponent expanded the normal columns {it: profile = & gt; Increase the table [one] ("one") with the import object.simple._ object object commoncolor {DRF exclusive 1 = column [string] ("exclusive 1") df * = common 1 ~ common 2 ~ exclusive 1 ; & Gt; (One.apply _, One.unapply _)}} And it worked.
Comments
Post a Comment