Groonga client library for Scala
Scala
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project
src
.gitignore
LICENSE
README.md
build.sbt

README.md

groonga4s - Groonga Scala Client

Supported command

  • select
  • load

Installation

Add a following dependency into your build.sbt at first.

libraryDependencies += "com.naokia" %% "groonga4s" % "0.7.0"

resolvers += "naokia github repository (snapshots)" at "http://naokia.github.io/repositories/snapshots"

Usage

Instantiate

val client = new GroongaClient("http://localhost:10041")

Select command

with filter

// select from "Site" table
case class Site(_key: String, genre: String, title: String)

val request = new SelectRequest.Builder("Site")
  .withOutputColumns(Seq("_key", "genre", "title"))
  .withFilter("""genre=="sns"""")
  .build
client.select(request).onComplete {
  case Success(result) => for (site <- result.as[Site]) println(site)
  case Failure(t) => println("Error: " + t.getMessage)
}

output drill downs

val drillDown = DrillDown("genre")
val request = new SelectRequest.Builder("Site")
  .withOutputColumns(Seq("_key", "genre", "title"))
  .withDrillDowns(Seq(drillDown))
  .build
client.select(request).onComplete {
  case Success(result) => println(result.drillDowns("genre")("sns").nsubrecs)
  case Failure(t) => println("Error: " + t.getMessage)
}

Load command

val site = Site("http://example.com", "sns", "example site")
client.load(new LoadRequest("Site", classOf[Site], List(site))).onComplete{
  case Success(result) => println(result.affected)
  case Failure(t) => println("Error: " + t.getMessage)
}