Skip to content

gitter-badger/RethinkDb.Driver

 
 

Repository files navigation

[![Build status](https://ci.appveyor.com/api/projects/status/8o06bhlnjss2n7k8?svg=true)](https://ci.appveyor.com/project/bchavez/rethinkdb-driver) [![Nuget](https://img.shields.io/nuget/v/RethinkDb.Driver.svg)](https://www.nuget.org/packages/RethinkDb.Driver/) [![Users](https://img.shields.io/nuget/dt/RethinkDb.Driver.svg)](https://www.nuget.org/packages/RethinkDb.Driver/) [![Twitter](https://img.shields.io/twitter/url/https/github.com/bchavez/RethinkDb.Driver.svg?style=social)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fbchavez%2FRethinkDb.Driver)

RethinkDb.Driver

Project Description

A RethinkDB database driver written in C# striving for 100% API compatibility and completeness.

This driver is based on the official Java Driver. This driver and the official Java Driver are still under active development.

The basic mechanics and architecture of both drivers are the same.

Download & Install

NuGet Package RethinkDb.Driver

Install-Package RethinkDb.Driver -Pre

While CoreCLR is still in beta, an additional restore fallback source is needed to restore Microsoft.Extensions.Logging.Abstractions reference:

dnu restore --fallbacksource https://www.myget.org/F/aspnetvnext/api/v2/

Supported Runtimes

<th><img src='https://github.com/Turbo87/Font-Awesome/raw/platform-icons/svg/windows.png'/> Windows</th>

<th><img src='https://github.com/Turbo87/Font-Awesome/raw/platform-icons/svg/linux.png'> Linux</th>

<th><img src='https://github.com/Turbo87/Font-Awesome/raw/platform-icons/svg/apple.png'/> Mac OS X</th>
Mono All platforms 4.0.2 SR2 or higher
CoreCLR All platforms 1.0.0-rc1-final or higher
.NET Framework v4.5 n/a n/a
RethinkDB server 2.2.0 or higher

Documentation

Quick Examples

public static RethinkDB r = RethinkDB.r;

[Test]
public void can_connect()
{
var c = r.connection()
         .hostname("192.168.0.11")
         .port(RethinkDBConstants.DEFAULT_PORT)
         .timeout(60)
         .connect();

int result = r.random(1, 9).add(r.random(1, 9)).run<int>(c);
    Console.WriteLine(result);
    result.Should().BeGreaterOrEqualTo(2).And.BeLessThan(18);
}
// Output: 8

[Test]
public void insert_poco_without_id()
{
    var obj = new Foo { Bar = 1, Baz = 2};
    var result = r.db(DbName).table(TableName).insert(obj).run(conn);
    result.Dump();
}
/*
    //JObject: Insert Response
	{
	  "deleted": 0,
	  "errors": 0,
	  "generated_keys": [
	    "6931c97f-de3d-46d2-b0f9-956af9517a57"
	  ],
	  "inserted": 1,
	  "replaced": 0,
	  "skipped": 0,
	  "unchanged": 0
	}
*/

[Test]
public void insert_an_array_of_pocos()
{
    var list = new[]
        {
            new Foo {id = "a", Baz = 1, Bar = 1},
            new Foo {id = "b", Baz = 2, Bar = 2},
            new Foo {id = "c", Baz = 3, Bar = 3}
        };
    var result = r.db(DbName).table(TableName).insert(list).run(conn);
    result.Dump();
}
/*
    //JObject Insert Response
    {
      "deleted": 0,
      "errors": 0,
      "inserted": 3,
      "replaced": 0,
      "skipped": 0,
      "unchanged": 0
    }
*/


[Test]
public void get_a_poco()
{
    Foo foo = r.db(DbName).table(TableName).get("abc").run<Foo>(conn);
    foo.Dump();
}
//Foo Object
/*
    {
      "id": "abc",
      "Bar": 1,
      "Baz": 2
    }
*/

Contributing

If you'd like to contribute, please consider reading some helpful tips before making changes.

Contributors

Created by Brian Chavez. Originally ported from the Java Driver by Josh Kuhn.

A big thanks to GitHub and all contributors:

About

A RethinkDB database driver in C# striving for 100% ReQL API compatibility and completeness.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 96.2%
  • JavaScript 3.7%
  • Other 0.1%