Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/unbit/librethinkdb
- Owner: unbit
- License: mit
- Created: 2012-12-09T07:16:28.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-10T09:33:00.000Z (almost 12 years ago)
- Last Synced: 2024-10-19T00:54:55.074Z (24 days ago)
- Language: C
- Size: 127 KB
- Stars: 23
- Watchers: 8
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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