Git Product home page Git Product logo

rethink-java-driver's Introduction

NOTICE

This driver is not officially supported by Dropbox. It is used solely by the Analytics Product team, and contains only minor bugfixes/improvements needed for our use.

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 [2015] [Dropbox]
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 ddfisher avatar zacharyvoase avatar

Stargazers

Gábor Mihálcz avatar Josué Acevedo (Neomatrix) avatar tianyu avatar  avatar Igor Brigadir avatar

Watchers

Greg Price avatar Chet Nichols III avatar Leah Culver avatar Connor McSheffrey avatar Jamie Turner avatar Ruslan Nigmatullin avatar Jathan McCollum avatar Herbert Ho avatar Zheng Shao avatar  avatar Manveer Chawla avatar Mark Smith avatar John Watson avatar Eitan Adler avatar Alex Degtiar avatar Daniel Eden avatar Adam Smith avatar Steven Kabbes avatar James Cloos avatar Li Haoyi avatar Nikhil Bhargava avatar  avatar Sujay Jayakar avatar Cat Obuhoff avatar Matt Cote avatar  avatar  avatar Chris Choy avatar edgar s avatar Richard Pickman avatar  avatar  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.