Welcome to the fascinating world of Guile, Scheme and Couchdb. Why would you like to use it? I don't know. Not sure how many pandas are out there interested but please free to reach out with any issue or comments. API will be changing rapidly so bear with me. My intentions is to wrap every single couchdb API function.
guile-couchdb wraps couchdb's REST API.
Happy Scheming!
- GNU Guile 2.x or 3.x
- A couchdb server to connect to. Tested with 3.3.x but should work with older and newer versions
- I use couchdb for Fedora from this copr and github
- test.scm uses guile-json 3.1.0
To be able to connect through https you need to get gnutls-guile bindings.
To install couchb.scm simply run install.scm
. The script will automatically install the module to the correct path as given by the guile calling the script on the first line of the script. Please change in case you want the install script to pick a different guile.
[panda@pandaville guile-couchdb]$ sudo ./install.scm
[HELLO] Installer script for guile-couchdb
[INFO] Running under: Linux x86_64
[INFO] Guile version: 2.9.1
[INFO] Guile library dir: /usr/local/share/guile/3.0
[INFO] Module guile-json found
[WARN] Module gnutls-guile not found
[INFO] Installing couchdb.scm module...
[INFO] Installation was succesful
[INFO] You can now use couchdb.scm with (use-modules (couchdb))
[BUH-BYE] Happy scheming!
(couchdb-root)
(couchdb-server! url port)
(couchdb-server-info)
(couchdb-up?)
(couchdb-uuids n)
(couchdb-version)
(couchdb-db-create cdb)
(couchdb-db-index cdb)
(couchdb-db-list)
(couchdb-db-find selector)
(couchdb-doc-delete cdb id)
(couchdb-doc-get cdb id)
(couchdb-doc-insert cdb id json)
(couchdb-doc-index cdb)
(couchdb-doc-list cdb)
[panda@pandaville guile-couchdb]$ ./test.scm
[INFO] couchdb test using: http://localhost:5984
[INFO] Guile version: 2.9.1
[COUCHDB] Couchdb server running: ok
[COUCHDB] Couchdb server version: 2.3.1
[COUCHDB] List all dbs: ["panda"]
[COUCHDB] Create DB panda
{"error":"file_exists","reason":"The database could not be created, the file already exists."}
[COUCHDB] Insert panda with id 'po'
{"error":"conflict","reason":"Document update conflict."}
[COUCHDB] Insert panda with id 'xiao'
{"ok":true,"id":"xiao","rev":"27-be31fddab5fbbcdf0015dc66eba459db"}
[COUCHDB] Get panda revision for id 'xiao'
27-be31fddab5fbbcdf0015dc66eba459db
[COUCHDB] Delete panda with id: 'xiao' and rev: 27-be31fddab5fbbcdf0015dc66eba459db
{"ok":true,"id":"xiao","rev":"28-8680843361a4b2e26b32abd31dfc2f08"}
Copyright (C) 2019-2024 Anne Summers <ukulanne@gmail.com>
guile-couchdb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
guile-couchdb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with guile-couchdb. If not, see https://www.gnu.org/licenses/.