I would like to define my Primary Keys as specific types - not just Long
or String
For example
case class Project(
var id: ProjectId = 0,
One advantage of this is if I accidently compare different keys - then the compiler will pick it up.
Obviously this gives the compile error
overriding method id in trait KeyedEntity of type => Long;
variable id has incompatible type
Are there any example's where this type of approach is successfully implemented?
Appendix - a draft of what ProjectId could be
trait SelfType[T] {
val self : T
}
class Content_typeId( val self: Int) extends SelfType[Int]
class ProjectId( val self: Long) extends SelfType[Long]
object ProjectId {
implicit def baseToType(self: Long) = new ProjectId(self)
implicit def typeToBase(higherSelf: ProjectId) : Long = higherSelf.self
}
Thanks Brent
--
You received this message because you are subscribed to the Google Groups "Squeryl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to squeryl+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.