A relaxing Rust lib.
Rust, as fresh as possible, no release versions. Tested against 7fbcb4.
git clone --recursive https://github.com/skade/rust-couchdb.git
cd rust-couchdb
make
make test
use couch::{Server,Document};
#[deriving(Encodable,Decodable)]
struct TestDocument {
_id: ~str,
body: ~str
}
impl Document for TestDocument {
fn id(&self) -> ~str {
self._id.clone()
}
}
fn main() {
let mut server = Server::new(~"http://localhost:5984");
let ~mut database = ~server.create_database(~"create_doc");
let test_doc = &TestDocument { _id: ~"test", body: ~"test" };
database.put(test_doc);
}
Make sure you use mutable pointers to Server and Database if you want to change anything. The API makes sure that immutable handles are read-only.
- Reading server info
- Creating databases
- Deleting databases
- Creating documents using the PUT api
Everything else.