A work in progress CouchDB client library.
- Install Zig
0.11.0
on your system. - Follow the CouchDB installation instructions to setup CouchDB on your system.
- Then check out one of the examples. After running
zig build
you can find the executables inzig-out/bin
.
Note: You have to adjust the examples (e.g. username and password)!
First add this library as dependency to your build.zig.zon
file:
.{
.name = "your-project",
.version = 0.0.1,
.dependencies = .{
.snorlax = .{
.url = "https://github.com/r4gus/snorlax/archive/master.tar.gz",
.hash = "<your hash>",
}
},
}
The easiest way to obtain the hash is to leave it blank or enter a wrong hash and then copy the correct one from the error message.
Then within your build.zig
:
// Fetch the dependency...
const snorlax_dep = b.dependency("snorlax", .{
.target = target,
.optimize = optimize,
});
// ...and obtain the module
const snorlax_module = snorlax_dep.module("snorlax");
...
// Add this module to your executable
exe.addModule("snorlax", snorlax_module);
After you've added the snorlax
module to your application, you can import it using
const snorlax = @import("snorlax");
.
Currently the library supports the following operations:
- Create a new database by using the
createDatabase
function - Delete a database (and all its documents) by using the
deleteDatabase
function - Create a new document by using the
createDocument
function - Find a document based on selectors by using the
find
function - Read a specific document by using the
read
function - Update a existing document by using the
update
function - Delete a existing document by using the
delete
function
Check out the examples folder for an overfiew on how to use the library.