GithubHelp home page GithubHelp logo

adamhjk / couchbase-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from couchbaselabs/couchbase-rs

0.0 0.0 0.0 5.52 MB

The official Couchbase Rust SDK

Home Page: https://couchbase.com

License: Apache License 2.0

Rust 3.29% CMake 1.44% Perl 0.08% C 48.81% C++ 43.87% Shell 0.04% Makefile 0.10% HTML 0.05% CSS 0.34% Batchfile 0.01% Roff 1.53% Ruby 0.10% Objective-C 0.12% JavaScript 0.21%

couchbase-rs's Introduction

Couchbase Rust SDK

LICENSE Crates.io Version

This is the repository for the official, community supported Couchbase Rust SDK. It is currently a work in progress and built on top of libcouchbase.

Requirements

Make sure to have all libcouchbase requirements satisfied to build it properly. Also bindgen requirements need to be in place. Other than that, you should be good to go out of the box if you use a recent rust version. We recommend the 2018 edition just because.

Installation

[dependencies]
couchbase = "1.0.0-alpha.2"

Usage

The examples folder has a bunch more, but here is a basic getting started doing a kv op:

use couchbase::Cluster;
use futures::Future;
use serde_derive::Deserialize;

#[derive(Debug, Deserialize)]
struct Airport {
    airportname: String,
    icao: String,
}

fn main() {
    let mut cluster = Cluster::connect("couchbase://127.0.0.1", "Administrator", "password")
        .expect("Could not create Cluster reference!");

    let bucket = cluster
        .bucket("travel-sample")
        .expect("Could not open bucket");
    let collection = bucket.default_collection();

    let found_doc = collection
        .get("airport_1297", None)
        .wait()
        .expect("Error while loading doc");
    println!("Airline Document: {:?}", found_doc);

    if found_doc.is_some() {
        println!(
            "Content Decoded {:?}",
            found_doc.unwrap().content_as::<Airport>()
        );
    }

    cluster.disconnect().expect("Could not shutdown properly");
}

Examples

More examples can be found in the examples folder. Please open a ticket if something is not present or does not showcase what you need.

couchbase-rs's People

Contributors

daschl avatar mikegoldsmith 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.