Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/unbit/librethinkdb

a c library for accessing rethinkdb servers
https://github.com/unbit/librethinkdb

Last synced: 3 days ago
JSON representation

a c library for accessing rethinkdb servers

Awesome Lists containing this project

README

        

librethinkdb
============

a C library for accessing rethinkdb servers

Example
-------

```c

#include

// connect to the rethinkdb server (addr, port, milliseconds_timeout)
struct rethinkdb_connection *r = rethinkdb_init("127.0.0.1", 28015, 1000);

// create a db (returns 0 on success)
rethinkdb_create_db(r, "foobar");
// create a table (returns 0 on success)
rethinkdb_create_table(r, "foobar", "mytable", NULL, NULL, 0);

// insert 3 json items
char *json[] = {
"{\"foo\": \"bar\"}",
"{\"foo2\": \"bar2\"}",
"{\"foo3\": \"bar3\"}",
};
// returns a json string with the response
rethinkdb_insert(r, "foobar", "mytable", json, 3, 0);

// get the items of a table (returns NULL on error)
unsigned int i, n_items = 0;
char **items = rethinkdb_table(r, "foobar", "mytable", 0, &n_items);

for(i=0;i