2017-01-10 14 views
0

我試圖從外包工phantom維基上的佈局tut。CollectionColumn有什麼問題?

我使用的是測試模型:

case class User (id: String, name: String, friends: List[String]) 

有:

import com.websudos.phantom.dsl._ 

class Users extends CassandraTable[Users, User] { 
    object id extends StringColumn(this) with PartitionKey[String] 
    object name extends StringCoumn(this) 
    object friends extends ListColumn[String](this) 
} 

ListColumn[String]()參數this被標記爲這我相信我甚至不應該刻意去打造一個錯誤。預計CassandraTable[String, User]而不是this

我使用的版本1.29.6

我使用來自維基例如不同的版本?或缺少其他東西?

回答

1

這是一個InteliJ強調問題。 ListColumn被定義爲Cassandra表內的類型別名,並且對於所有使用構造函數參數的類型別名,InteliJ無法通過它們進行查看。除此之外,僅僅因爲2.0.0中所做的所有新的改進,我都會真正升級到幻像2.0.0+。有相當多的工作是走了到固定錯誤並減少你需要多少代碼鍵入:+,該this參數使用新不再需要

import com.outworkers.phantom.dsl._ 

class Users extends CassandraTable[Users, User] { 
    object id extends StringColumn(this) with PartitionKey 
    object name extends StringCoumn(this) 
    object friends extends ListColumn[String](this) 
} 

在較新版本幻影,2.9.x的緊湊的DSL。

import com.outworkers.phantom.dsl._ 

abtract class Users extends Table[Users, User] { 
    object id extends StringColumn with PartitionKey 
    object name extends StringColumn 
    object friends extends ListColumn[String] 
}