Cassandra Phantom - 找不到参数助手的隐式值:com.outworkers.phantom.macros.TableHelper[Users, User]
Cassandra Phantom - could not find implicit value for parameter helper: com.outworkers.phantom.macros.TableHelper[Users, User]
我正在使用 Cassandra Phantom 驱动程序通过 Scala 和 Cassandra 构建应用程序。我的代码如下所示:
case class User(id: UUID, name:String)
abstract class Users extends CassandraTable[Users, User] with RootConnector {
object id extends UUIDColumn(this) with PartitionKey
object name extends StringColumn(this)
def save(user: User): Future[ResultSet] = {
insert
.value(_.id, user.id)
.value(_.name, user.name)
.consistencyLevel_=(ConsistencyLevel.ALL)
.future()
}
def getById(id: UUID): Future[Option[User]] = {
select.where(_.id eqs id).one()
}
}
但是当我尝试编译代码时出现以下错误:
could not find implicit value for parameter helper: com.outworkers.phantom.macros.TableHelper[Users, User]
我无法理解为什么在遵循文档时会出现此错误。
幻影版本:2.7.6
斯卡拉:2.11.2
case class User(id: UUID, name:String)
abstract class Users extends Table[Users, User] with RootConnector {
object id extends UUIDColumn(this) with PartitionKey
object name extends StringColumn(this)
def save(user: User): Future[ResultSet] = {
store(user)
.consistencyLevel_=(ConsistencyLevel.ALL)
.future()
}
def getById(id: UUID): Future[Option[User]] = {
select.where(_.id eqs id).one()
}
}
我刚刚用 2.7.6 编译了这个,你也不需要手动实现一个 insert
因为它已经为你生成了。
我正在使用 Cassandra Phantom 驱动程序通过 Scala 和 Cassandra 构建应用程序。我的代码如下所示:
case class User(id: UUID, name:String)
abstract class Users extends CassandraTable[Users, User] with RootConnector {
object id extends UUIDColumn(this) with PartitionKey
object name extends StringColumn(this)
def save(user: User): Future[ResultSet] = {
insert
.value(_.id, user.id)
.value(_.name, user.name)
.consistencyLevel_=(ConsistencyLevel.ALL)
.future()
}
def getById(id: UUID): Future[Option[User]] = {
select.where(_.id eqs id).one()
}
}
但是当我尝试编译代码时出现以下错误:
could not find implicit value for parameter helper: com.outworkers.phantom.macros.TableHelper[Users, User]
我无法理解为什么在遵循文档时会出现此错误。
幻影版本:2.7.6
斯卡拉:2.11.2
case class User(id: UUID, name:String)
abstract class Users extends Table[Users, User] with RootConnector {
object id extends UUIDColumn(this) with PartitionKey
object name extends StringColumn(this)
def save(user: User): Future[ResultSet] = {
store(user)
.consistencyLevel_=(ConsistencyLevel.ALL)
.future()
}
def getById(id: UUID): Future[Option[User]] = {
select.where(_.id eqs id).one()
}
}
我刚刚用 2.7.6 编译了这个,你也不需要手动实现一个 insert
因为它已经为你生成了。