couchdb-connect
couchdb-server?
couchdb-db
couchdb-database?
couchdb-info
couchdb-all-dbs
couchdb-get
couchdb-put
couchdb-delete
couchdb-delete-db
couchdb-view
exn: couchdb?
exn: couchdb: conflict?
exn: couchdb: not-found?
Version: 5.2

CouchDB

Jan Dvorak <mordae@anilinux.org>

CouchDB client for Racket.

 (require (planet mordae/couchdb:1:6))
Most functions in this module can raise exn:couchdb? exceptions.
There are two special ones, that you might want to handle separately, they are exn:couchdb:conflict? which is raised when document to be modified have been altered by another client and exn:couchdb:not-found? which is raised when given document simply does not exist.

(couchdb-connect [#:host host    
  #:port port    
  #:user user    
  #:password password])  couchdb-server?
  host : string? = "localhost"
  port : exact-nonnegative-integer? = 5984
  user : (or/c string? #f) = #f
  password : (or/c string? #f) = #f
Creates CouchDB server connection information.

In reality, this does not connect anywhere. Provided options are stored in newly created couchdb-server? structure, which is then used for the purpose of URL construction.

(couchdb-server? value)  boolean?
  value : any/c
Determines if given value is a CouchDB server information returned by couchdb-connect.

(couchdb-db server name)  couchdb-database?
  server : couchdb-server?
  name : string?
Creates database connection structure.

Result of this function is used in all database-local queries. It contains both the server and database name, which are used in URL construction.

(couchdb-database? value)  boolean?
  value : any/c
Determines if given value is a CouchDB database returned by couchdb-db.

(couchdb-info server-or-db)  jsexpr?
  server-or-db : (or/c couchdb-server? couchdb-database?)
Returns information about server or database.

(couchdb-all-dbs server)  jsexpr?
  server : couchdb-server?
Returns list with names of all databases present on the server.

(couchdb-get db    
  id    
  [#:rev rev    
  #:open-revs open-revs    
  #:revs-info? revs-info?    
  #:conflicts? conflicts?])  jsexpr?
  db : couchdb-database?
  id : string?
  rev : (or/c string? (symbols 'current)) = 'current
  open-revs : 
(or/c (symbols 'all 'current)
      (listof string?))
 = 'current
  revs-info? : boolean? = #f
  conflicts? : boolean? = #f
Retrieves specified document from given CouchDB database.

Consult CouchDB documentation for information on keyword arguments.

(couchdb-put db document)  jsexpr?
  db : couchdb-database?
  document : jsexpr?
Stores specified document in given CouchDB database.

(couchdb-delete db document)  jsexpr?
  db : couchdb-database?
  document : jsexpr?
Deletes specified document from the CouchDB database.

Deletes given database from the server.

(couchdb-view db    
  view    
  [#:include-docs? include-docs?    
  #:key key    
  #:startkey startkey    
  #:startkey-docid startkey-docid    
  #:endkey endkey    
  #:endkey-docid endkey-docid    
  #:limit limit    
  #:stale stale    
  #:descending? descending?    
  #:skip skip    
  #:group? group    
  #:group-level group-level    
  #:reduce? reduce?    
  #:inclusive-end? inclusive-end?    
  #:update-seq? update-seq?])  jsexpr?
  db : couchdb-database?
  view : (list/c string? string?)
  include-docs? : boolean? = #f
  key : (or/c jsexpr? void?) = (void)
  startkey : (or/c jsexpr? void?) = (void)
  startkey-docid : (or/c jsexpr? void?) = (void)
  endkey : (or/c jsexpr? void?) = (void)
  endkey-docid : (or/c jsexpr? void?) = (void)
  limit : (or/c exact-nonnegative-integer? void?) = (void)
  stale : (or/c (symbols 'ok 'update-after) void?) = (void)
  descending? : boolean? = #f
  skip : exact-nonnegative-integer? = 0
  group : boolean? = #f
  group-level : (or/c exact-nonnegative-integer? void?) = (void)
  reduce? : (or/c boolean? void?) = (void)
  inclusive-end? : boolean? = #t
  update-seq? : boolean? = #f
Queries a stored view.

Consult CouchDB documentation for information on keyword arguments.

(exn:couchdb? value)  boolean?
  value : any/c
Generic CouchDB exception.

(exn:couchdb:conflict? value)  boolean?
  value : any/c
Revision conflict exception.
(exn:couchdb:not-found? value)  boolean?
  value : any/c
Document not found exception.