Skip to content

TheWeatherChannel/cassie-composite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

This codec allows for operations on composite columns, which is currently not supported in Cassie.

Example usage:

val cluster = new Cluster("localhost", 9160)
val keyspace = cluster.keyspace("test").connect()
val compositeTest = keyspace.columnFamily("CompositeTest", Utf8Codec, CompositeCodec, Utf8Codec)
                            .consistency(ReadConsistency.One)
                            .consistency(WriteConsistency.One)

val composite = Composite(Component("c1", Utf8Codec), Component(2, LongCodec))
compositeTest.insert("testkey", Column(composite, "testval2"))()

println("row ==")
compositeTest.getRow("testkey")().foreach(c => printCol(c._2))

println("one col ==")
compositeTest.getRowSlice("testkey2",
                          Some(Composite(Component("c1", Utf8Codec, ComponentEquality.EQ))),
                          Some(Composite(Component("c1", Utf8Codec, ComponentEquality.GTE))),
                          Int.MaxValue)()
             .foreach(printCol)

// Decoding a composite
val decoder = Decoder(Utf8Codec, LongCodec)

def printCol(c: Column[Composite, String]) = {
  val colName = decoder.decode(c.name)
  val c1 = colName._1.value
  val c2 = colName._2.value
  println(c1 + ":" + c2  + " = " + c.value)
}

Maven:

<dependency>
  <groupId>com.weather</groupId>
  <artifactId>cassie-composite</artifactId>
  <version>1.0</version>
</dependency>

About

A composite codec for Twitter's Cassie Cassandra client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages