Coder Social home page Coder Social logo

quarkus-couchbase's Introduction

Quarkus Couchbase Extension

All Contributors

Integrates Couchbase into Quarkus.

GitHub Workflow Status Version Total alerts Language grade: Java

This extension is currently in alpha status. It supports:

  • Dependency injecting a Couchbase Cluster.
  • Configuring the Cluster through application.properties. Currently a minimal set of configuration options is provided.
  • Graal/native-image, though so far it has been minimally tested with basic cases.

Please try it out and provide feedback, ideas and bug reports on Github.

Usage

Add it to your project:

<dependency>
  <groupId>io.quarkiverse.couchbase</groupId>
  <artifactId>quarkus-couchbase</artifactId>
  <version>1.0.0-alpha.1</version>
</dependency>

Provide the Couchbase configuration in application.properties:

quarkus.couchbase.connection-string=localhost
quarkus.couchbase.username=username
quarkus.couchbase.password=password

Now you can @Inject a Couchbase Cluster into your project:

@Path("/couchbase")
public class TestCouchbaseResource {
    @Inject
    Cluster cluster;

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Path("/test")
    public String run() {
        // Get a reference to a particular Couchbase bucket and its default collection
        var bucket = cluster.bucket("travel-sample");
        var collection = bucket.defaultCollection() ;

        // Upsert a new document
        collection.upsert("test", JsonObject.create().put("foo", "bar"));

        // Fetch and print a document
        var doc = bucket.defaultCollection().get("test");
        System.out.println("Got doc " + doc.contentAsObject().toString());

        // Perform a N1QL query
        var queryResult = cluster.query("select * from `travel-sample` where url like 'http://marriot%' and country = 'United States';");

        queryResult.rowsAsObject().forEach(row -> {
            System.out.println(row.toString());
        });

        return "success!";
    }
}

And test http://localhost:8080/couchbase/test.

Limitations

In this early alpha release the configuration options are limited to the three shown above.
This means that a Couchbase cluster configured securely and requiring TLS or a client or server certificate, cannot currently be connected to.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Graham Pople

๐Ÿ’ป ๐Ÿšง

This project follows the all-contributors specification. Contributions of any kind welcome!

quarkus-couchbase's People

Contributors

programmatix avatar dependabot[bot] avatar gastaldi avatar allcontributors[bot] 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.