我使用 Quill 库编写了这个简单的应用程序来查询 Cassandra
QuillSample.scala
import java.util.UUID
import io.getquill._
import scala.concurrent.ExecutionContext.Implicits.global
object QuillSample extends App {
lazy val ctx = new CassandraSyncContext[SnakeCase]("ctx")
import ctx._
val getAllRows = quote {
query[Movies]
}
val result = ctx.run(getAllRows)
println(result)
}
case class Movies(uUID: UUID,
avgRating: Float,
genres: Set[String],
name: String,
releaseDate: java.util.Date,
videoReleaseDate: java.util.Date)
构建.sbt
name := "QuillSample"
version := "1.0"
scalaVersion := "2.12.0"
libraryDependencies ++= Seq(
"io.getquill" % "quill-cassandra_2.11" % "1.0.0"
)
应用程序属性
ctx.keyspace=movielens_small
ctx.preparedStatementCacheSize=1000
ctx.session.contactPoint=192.168.1.169
ctx.session.withPort=9042
ctx.session.queryOptions.consistencyLevel=LOCAL_QUORUM
ctx.session.withoutMetrics=true
ctx.session.withoutJMXReporting=false
ctx.session.maxSchemaAgreementWaitSeconds=1
ctx.session.addressTranslater=com.datastax.driver.core.policies.IdentityTranslator
这将返回编译时错误
Error:(14, 12) Can't find an implicit `SchemaMeta` for type `com.abhi.Movies`
query[Movies]
根据此处给出的文档
https://github.com/getquill/quill/blob/master/CASSANDRA.md
我不确定需要哪些其他代码来满足缺失的隐式。