Scala / Play:分配一个尚未存在的值

时间:2014-03-08 14:45:39

标签: scala playframework slick

说我有这样的事情:

case class User(id:Option[Long], name: String)

case class Account(id:Option[Long], userId: Long)

object Account {
    // apply method
    def apply(i: Identity): Account = {
        Account(None,SomeFutureUserId)
    }
}

由于某种原因,这不起作用:

Account = Account(None,SomeUser.id)

我怎么让玩!知道会有Long类型代替id吗?像占位符这样的东西?

1 个答案:

答案 0 :(得分:0)

试试这个:

case class User(id:Option[Long], name: String)

case class Account(id:Option[Long], userId: Option[Long])

object Account {
    // apply method
    def apply(i: Identity): Account = {
        Account(None,None)
    }
}