GithubHelp home page GithubHelp logo

francoisrichard / rethink-java-driver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from npiv/rethink-java-driver

0.0 2.0 0.0 1.36 MB

A Java RethinkDB Driver

Home Page: http://npiv.github.io/rethink-java-doc/html/

Java 82.11% Protocol Buffer 17.89%

rethink-java-driver's Introduction

NOTICE

I am not actively using rethink anymore and have little time to maintain the project. It may be possible that time opens up in the near future, but if anyone is eager to take this over / help out they are welcome to contact me.

Introduction

Full Documentation here

Maven Central

Include in your pom with

<dependency>
    <groupId>com.rethinkdb</groupId>
    <artifactId>rethink-java-driver</artifactId>
    <version>0.3</version>
</dependency>

Examples

The driver supports java 1.6 and up. But to truly get the benefit of the lambda support java 8 is recommended.

in java 8 one can do something Like

RethinkDB r = RethinkDB.r;
RethinkDBConnection con = r.connect();

r.db("test").tableCreate("heros").run(con);
con.use("test");

r.table("heros").insert(
        new MapObject().with("name", "Heman").with("age", 33).with("skill", "sword"),
        new MapObject().with("name", "Spiderman").with("age", 27).with("skill", "jumping"),
        new MapObject().with("name", "Superman").with("age", 133).with("skill", "flying"),
        new MapObject().with("name", "Xena").with("age", 29).with("skill", "wowza")
).run(con);

System.out.println(
        r.table("heros").filter(hero->hero.field("age").gt(100)).pluck("age").run(con)
); // [{age=133.0}]

System.out.println(
        r.table("heros").orderBy(r.desc("age")).map(hero -> hero.field("name").upcase()).run(con)
); // [SUPERMAN, HEMAN, XENA, SPIDERMAN]

System.out.println(
        r.table("heros").update(row ->
                        r.branch(
                                row.field("age").gt(100),
                                new MapObject().with("newAttribute", "old"),
                                new MapObject().with("newAttribute", "young")
                        )
        ).run(con)
); // DMLResult{inserted=0, replaced=4, unchanged=0, errors=0, first_error=null, deleted=0, skipped=0, generated_keys=null, old_val=null, new_val=null}

System.out.println(
        r.table("heros").pluck("name","newAttribute").run(con)
); // [
   // {newAttribute=young, name=Xena},
   // {newAttribute=young, name=Spiderman},
   // {newAttribute=old,   name=Superman},
   // {newAttribute=young, name=Heman}
   // ]

See API Documentation and more examples here: http://npiv.github.io/rethink-java-doc/html

Apache License 2.0

Copyright [2014] [Nick Verlinde]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

rethink-java-driver's People

Contributors

npiv avatar

Watchers

Francois Richard avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.