Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r4gus/snorlax
CouchDB client
https://github.com/r4gus/snorlax
couchdb couchdb-client database zig ziglang
Last synced: 24 days ago
JSON representation
CouchDB client
- Host: GitHub
- URL: https://github.com/r4gus/snorlax
- Owner: r4gus
- Created: 2023-08-15T22:18:50.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-22T18:28:36.000Z (over 1 year ago)
- Last Synced: 2024-10-15T02:44:10.223Z (2 months ago)
- Topics: couchdb, couchdb-client, database, zig, ziglang
- Language: Zig
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snorlax
A __work in progress__ [CouchDB](https://couchdb.apache.org/) client library.
## Getting started
1. Install [Zig](https://ziglang.org/download/) `0.11.0` on your system.
2. Follow the CouchDB [installation instructions](https://docs.couchdb.org/en/stable/install/index.html)
to setup CouchDB on your system.
3. Then check out one of the [examples](examples). After running `zig build` you can find the executables in `zig-out/bin`.> Note: You have to adjust the examples (e.g. username and password)!
### Adding Snorlax to your application
First add this library as dependency to your `build.zig.zon` file:
```zon
.{
.name = "your-project",
.version = 0.0.1,.dependencies = .{
.snorlax = .{
.url = "https://github.com/r4gus/snorlax/archive/master.tar.gz",
.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`:
```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");`.## Overfiew
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` functionCheck out the [examples](examples) folder for an overfiew on how to use the library.