cassandra-driver - DataStax Node.js Driver for Apache Cassandra.
A modern, feature-rich and highly tunable Node.js client library for Apache Cassandra (1.2+) and DataStax Enterprise (3.1+) using exclusively Cassandra's binary protocol and Cassandra Query Language v3.
$ sbt clean publish-local
Before running the tests the first time, you must ensure the npm packages are installed:
$ npm install
Then you can run the tests:
$ sbt test
import io.scalajs.nodejs.console
import io.scalajs.npm.cassandradriver._
import scalajs.js
val client = new Client(new ClientOptions(contactPoints = js.Array("localhost"), keyspace = "classroom"))
val students = Seq(
js.Array("123456", "Larry Sanders", "Operating Systems")
)
students foreach { params =>
client.execute("INSERT INTO students (id, name, course) VALUES (?, ?, ?)", params, (err, student) => {
console.log("student =>", student)
})
}
class Student(val id: String, val name: String, val course: String) extends js.Object
To add the CassandraDriver
binding to your project, add the following to your build.sbt:
libraryDependencies += "io.scalajs.npm" %%% "cassandra-driver" % "0.5.0"
Optionally, you may add the Sonatype Repository resolver:
resolvers += Resolver.sonatypeRepo("releases")