CollectionColumn 有什么问题?

What's wrong with CollectionColumn?

我正在按照 wiki 上的布局尝试 phantom 外工。

我正在使用测试模型:

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

我使用的是与 wiki 示例不同的版本吗?或者还遗漏了什么?

这是一个 InteliJ 突出显示问题。 ListColumn 被定义为 Cassandra table 内部的类型别名,对于所有采用构造函数参数的类型别名,InteliJ 无法看穿它们。

除此之外,我真的会升级到 phantom 2.0.0+,因为 2.0.0 中所做的所有新改进。在修复错误和减少您需要输入的代码量方面已经做了很多工作:

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)
}

在更新的 phantom 2.9.x+ 版本中,使用新的紧凑型 DSL 不再需要 this 参数。

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]
}