Skip to content

Counter columns

Flavian Alexandru edited this page May 29, 2015 · 5 revisions

Build Status Coverage Status Maven Central Download

phantom supports using Counter columns out of the box. To learn about counters, first read this.

The companion test table is here.

The available operations and the tests are here.

import com.websudos.phantom.dsl._

class CounterTableTest extends CassandraTable[CounterTableTest, CounterRecord] {

  object id extends UUIDColumn(this) with PartitionKey[UUID]
  object count_entries extends CounterColumn(this)

  def fromRow(row: Row): CounterRecord = {
    CounterRecord(id(row), count_entries(row))
  }
}

object CounterTableTest extends CounterTableTest {
  override val tableName = "counter_column_test"

}