Package

com.outworkers.phantom.example

basics

Permalink

package basics

Visibility
  1. Public
  2. All

Type Members

  1. abstract class CompositeKeyRecipes extends CassandraTable[CompositeKeyRecipes, Recipe] with Table[CompositeKeyRecipes, Recipe]

    Permalink

    In this example we will create a table storing recipes.

    In this example we will create a table storing recipes. This time we will use a composite key formed by name and id.

  2. trait DockerConnector extends Connector

    Permalink
  3. trait ExampleConnector extends Connector

    Permalink

    This is an example of how to connect to Cassandra in the easiest possible way.

    This is an example of how to connect to Cassandra in the easiest possible way. The SimpleCassandraConnector is designed to get you up and running immediately, with almost 0 effort.

    What you have to do now is to tell phantom what keyspace you will be using in Cassandra. This connector will automaticalyl try to connect to localhost:9042. If you want to tell the connector to use a different host:port combination, simply override the address inside it.

    Otherwise, simply mixing this connector in will magically inject a database session for all your queries and you can immediately run them.

  4. case class Recipe(id: UUID, name: String, title: String, author: String, description: String, ingredients: Set[String], props: Map[String, String], timestamp: DateTime) extends Product with Serializable

    Permalink

    In this example we will create a simple table storing recipes.

    In this example we will create a simple table storing recipes. Data modeling with com.outworkers.phantom is trivial and covers some of the more advanced features of Cassandra.

    Phantom will auto-generate the CQL3 table definition from your Scala code. And you can automatically insert the schema during tests or even live environments.

    This is a very straightforward example, with a non composite Partition key

  5. abstract class Recipes extends CassandraTable[Recipes, Recipe] with Table[Recipes, Recipe]

    Permalink
  6. case class SampleRecord(stuff: String, someList: List[String], thriftModel: SampleModel) extends Product with Serializable

    Permalink
  7. abstract class SecondaryKeyRecipes extends CassandraTable[SecondaryKeyRecipes, Recipe] with Table[SecondaryKeyRecipes, Recipe]

    Permalink

    In this example we will create a table storing recipes with a SecondaryKey.

    In this example we will create a table storing recipes with a SecondaryKey. This time we will use a non-composite Primary key with a SecondaryKey on author.

  8. abstract class ThriftTable extends CassandraTable[ThriftTable, SampleRecord] with Table[ThriftTable, SampleRecord]

    Permalink

Value Members

  1. object Defaults

    Permalink
  2. object RemoteConnector

    Permalink

    This is an example of how to connect to a custom set of hosts and ports.

    This is an example of how to connect to a custom set of hosts and ports. First, we need to obtain a connector and keep a singleton reference to it. It's really important to guarantee we are using a singleton here, otherwise we will end up spawning a cluster on every call.

  3. package thrift

    Permalink

Ungrouped