Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couchbase module #417

Closed
jknack opened this issue Jul 9, 2016 · 0 comments
Closed

couchbase module #417

jknack opened this issue Jul 9, 2016 · 0 comments

Comments

@jknack
Copy link
Member

jknack commented Jul 9, 2016

import org.jooby.couchbase.*;

{
   use(new Couchbase("couchbase://localhost/default"));

   get("/", req -> {
     Bucket bucket = req.require(Bucket.class);
     //... do with default bucket
   });
}

Reactive version works with http://jooby.org/doc/rxjava/:

import org.jooby.couchbase.*;
import org.jooby.rx.*;

{
   use(new Rx());
   use(new Couchbase("couchbase://localhost/default"));

   get("/", req -> {
     AsyncBucket bucket = req.require(AsyncBucket.class);
     //... do with default async bucket
   });
}

Basic CRUD will be available via Datastore service (provided by jooby)

 use("/api/beer")
        .post(req -> {
          return req.require(Datastore.class).upsert(req.body().to(Beer.class));
        })
        .get("/:id", req -> {
          return req.require(Datastore.class).get(req.param("id").value(), Beer.class);
        })
        .delete("/:id", req -> {
          return req.require(Datastore.class).remove(req.param("id").value(), Beer.class);
        })
        .get(req -> {
          return require(Datastore.class).query(
              Select.select("b.*").from("`beer-sample` b"));
        });
@jknack jknack added this to the 1.0.0.CR7 milestone Jul 9, 2016
@jknack jknack closed this as completed in 2c541e4 Jul 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant