当前位置

网站首页> 程序设计 > 开源项目 > 编程语言 > 浏览文章

scala-cassandra

作者:小梦 来源: 网络 时间: 2024-04-02 阅读:

scala-cassandra 实现了对 Cassandra 的 DataStax Java 驱动程序的 Scala 封装。

示例代码:

class ScalaCassandraSpec extends Specification {     CQL.init()    CQL.startup("MetaStore")    Meta.createTable()     "Meta objects" should {      "be able to store & retrieve their binary state" in {       //we use a Thrift object here for portability of the data stored      val tMeta = new TMeta()       //setting up some randomness so we can confirm what we are writing is what we get back      val metaUUID = UUID.randomUUID()      val dataum = Random.alphanumeric.take(1000000).mkString       tMeta.setId(metaUUID.toString)      tMeta.setDatum(dataum)       Meta.save(tMeta) //Saved to C*       val someNewTMeta = Meta(metaUUID)      someNewTMeta.getId() must_== metaUUID.toString       someNewTMeta.getDatum() must_== dataum      }    }}

相关阅读

热点阅读

网友最爱