Java 8 and Scala Cassandra client.
Find a file
2015-03-27 20:15:42 -07:00
src create special package mapping.value for all column value 2015-03-27 20:15:42 -07:00
.gitignore added pom.xml 2015-03-14 10:22:57 -07:00
.travis-oss-settings.xml enable travis 2015-03-25 19:27:35 -07:00
.travis.yml update travis settings 2015-03-25 20:28:35 -07:00
eclipse-formatting.xml eclipse-formatting 2015-03-16 17:03:17 -07:00
LICENSE Initial commit 2015-02-26 12:42:59 -08:00
pom.xml Update pom.xml 2015-03-27 20:14:13 -07:00
README.md refactoring and update readme document 2015-03-27 20:15:42 -07:00

casser build

Java 8 Cassandra Client

Current status: Active development

Features

  • Leverages Java 8 language capabilities to build CQL queries
  • Simple function-style API
  • Reactive

Requirements

  • Only JVM 8
  • Datastax Driver
  • Maven

Example

Entity definition:

@Table("timelines")
public interface Timeline {

	@PartitionKey
	UUID userId();
	
	@ClusteringColumn
	@DataTypeName(Name.TIMEUUID)
	Date timestamp();
	
	@Column
	String text();
	
}

Session initialization:

Timeline timeline = Casser.dsl(Timeline.class);
CasserSession session = Casser.init(getSession()).showCql().add(Timeline.class).autoCreateDrop().get();

Select information:

session.select(timeline::userId, timeline::timestamp, timeline::text)
  .where(timeline::userId, Operator.EQ, userId)
  .orderBy(timeline::timestamp, "desc").limit(5).sync()
  .forEach(System.out::println);

Insert information:

TimelineImpl post = new TimelineImpl();
post.userId=userId;
post.timestamp=new Date(postTime+1000L*i);
post.text="hello";
session.upsert(post).sync();