rql

Scala driver for RethinkDB.

License

License

GroupId

GroupId

com.esyfur
ArtifactId

ArtifactId

rql
Last Version

Last Version

0.1.8
Release Date

Release Date

Type

Type

jar
Description

Description

rql
Scala driver for RethinkDB.
Project URL

Project URL

https://github.com/esycat/rql-scala
Project Organization

Project Organization

Persic Entertainment
Source Code Management

Source Code Management

https://github.com/esycat/rql-scala

Download rql

How to add to project

<!-- https://jarcasting.com/artifacts/com.esyfur/rql/ -->
<dependency>
    <groupId>com.esyfur</groupId>
    <artifactId>rql</artifactId>
    <version>0.1.8</version>
</dependency>
// https://jarcasting.com/artifacts/com.esyfur/rql/
implementation 'com.esyfur:rql:0.1.8'
// https://jarcasting.com/artifacts/com.esyfur/rql/
implementation ("com.esyfur:rql:0.1.8")
'com.esyfur:rql:jar:0.1.8'
<dependency org="com.esyfur" name="rql" rev="0.1.8">
  <artifact name="rql" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.esyfur', module='rql', version='0.1.8')
)
libraryDependencies += "com.esyfur" % "rql" % "0.1.8"
[com.esyfur/rql "0.1.8"]

Dependencies

compile (4)

Group / Artifact Type Version
joda-time : joda-time jar 2.3
com.google.protobuf : protobuf-java jar 2.5.+
org.scala-lang : scala-library jar 2.10.3
org.joda : joda-convert jar 1.3.1

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.10 jar 2.0.+

Project Modules

There are no modules declared in this project.

RethinkDB Scala Driver

The driver implements only the base part of the API.

It should work for RethinkDB v1.10.

Installation

SBT

appDependencies ++= Seq(
    "com.esyfur" % "rql" % "0.1.+"
)

Gradle

dependencies {
    compile group: 'com.esyfur', name: 'rql', version: '0.1.+'
}

Maven

<dependency>
    <groupId>com.esyfur</groupId>
    <artifactId>rql</artifactId>
    <version>0.1.+</version>
</dependency>

Usage

See the Main class for usage examples. Try gradle run to execute the class.

import com.esyfur.{rql => r}

val host = "localhost"
val db   = "awesomeness"
val tbl  = "beautifulThings"

val data = Map(...)

// connect to the server, set default connection and database
val conn = r.connect(host).repl().use(db)

// create a new database and show a list of existing databases
r.dbCreate(db).run()
r.dbList.run()

// create a new table and show a list of existing tables in the database
r.db(db).tableCreate(tbl).run()
r.db(db).tableList.run()

// insert some data
r.db(db).table(tbl).insert(data).run()

// select data from the table in different ways
r.db(db).table(tbl).limit(5).run()
r.db(db).table(tbl).slice(1, 2).run()

// check whether the table is empty
r.db(db).table(tbl).isEmpty.run()
r.db(db).table(tbl).count().run()

// math expressions
r.expr(5).add(2).add(10).sub(12).mul(6).div(3).mod(3).run()

// cleanup and disconnect
r.db(db).tableDrop(tbl).run()
r.dbDrop(db).run()
conn.close()

Development

To re-download and re-compile the protobuf API:

gradle protoApiDownload protoApiCompile

To run the test suite:

gradle test

Versions

Version
0.1.8
0.1.6
0.1.5