1package kivik 2 3const ( 4 // KivikVersion is the version of the Kivik library. 5 KivikVersion = "1.0.0-beta" 6 // KivikVendor is the vendor string reported by this library. 7 KivikVendor = "Kivik" 8) 9 10// SessionCookieName is the name of the CouchDB session cookie. 11const SessionCookieName = "AuthSession" 12 13// UserPrefix is the mandatory CouchDB user prefix. 14// See http://docs.couchdb.org/en/2.0.0/intro/security.html#org-couchdb-user 15const UserPrefix = "org.couchdb.user:" 16 17// EndKeySuffix is a high Unicode character (0xfff0) useful for appending to an 18// endkey argument, when doing a ranged search, as described here: 19// http://couchdb.readthedocs.io/en/latest/ddocs/views/collation.html#string-ranges 20// 21// Example, to return all results with keys beginning with "foo": 22// 23// rows, err := db.Query(context.TODO(), "ddoc", "view", map[string]interface{}{ 24// "startkey": "foo", 25// "endkey": "foo" + kivik.EndKeySuffix, 26// }) 27const EndKeySuffix = string(0xfff0) 28 29// HTTP methods supported by CouchDB. This is almost an exact copy of the 30// methods in the standard http package, with the addition of MethodCopy, and 31// a few methods left out which are not used by CouchDB. 32const ( 33 MethodGet = "GET" 34 MethodHead = "HEAD" 35 MethodPost = "POST" 36 MethodPut = "PUT" 37 MethodDelete = "DELETE" 38 MethodCopy = "COPY" 39) 40 41// HTTP response codes permitted by the CouchDB API. 42// See http://docs.couchdb.org/en/1.6.1/api/basics.html#http-status-codes 43const ( 44 StatusOK = 200 45 StatusCreated = 201 46 StatusAccepted = 202 47 StatusFound = 302 48 StatusNotModified = 304 49 StatusBadRequest = 400 50 StatusUnauthorized = 401 51 StatusForbidden = 403 52 StatusNotFound = 404 53 StatusMethodNotAllowed = 405 54 StatusRequestTimeout = 408 55 StatusConflict = 409 56 StatusPreconditionFailed = 412 57 StatusStatusRequestEntityTooLarge = 413 58 StatusUnsupportedMediaType = 415 59 StatusRequestedRangeNotSatisfiable = 416 60 StatusExpectationFailed = 417 61 StatusInternalServerError = 500 62 63 // StatusNotImplemented is not returned by CouchDB proper. It is used by 64 // Kivik for optional features which are not implemented by some drivers. 65 StatusNotImplemented = 501 66 67 // Error status over 600 are obviously not proper HTTP errors at all. They 68 // are used for kivik-generated errors of various types. 69 70 // StatusUnknownError is used for unclassified errors generated by Kivik, 71 // generally caused by a programming error. 72 StatusUnknownError = 600 73 74 // StatusNetworkError represents an error that occurred outside of the HTTP 75 // transport, such as a problem contacting the remote server. This code is 76 // used to distinguish from actual HTTP-layer errors. 77 StatusNetworkError = 601 78 79 // StatusBadResponse indicates that the server responded with unrecognized 80 // data. 81 StatusBadResponse = 602 82 83 // StatusIteratorUnusable indicates an improper use of an iterator, such as 84 // calling an iterator prematurely, or after it was closed. 85 StatusIteratorUnusable = 603 86) 87