func BasicAuth(username, password string) kivik.Option
BasicAuth provides support for HTTP Basic authentication. Pass this option to github.com/go-kivik/kivik/v4.New to use Basic Authentication.
func CookieAuth(username, password string) kivik.Option
CookieAuth provides CouchDB Cookie auth. Cookie Auth is the default authentication method if credentials are included in the connection URL passed to github.com/go-kivik/kivik/v4.New. You may also pass this option as an argument to the same function, if you need to provide your auth credentials outside of the URL.
func JWTAuth(token string) kivik.Option
JWTAuth provides support for CouchDB JWT-based authentication. Kivik does no validation on the JWT token; it is passed verbatim to the server.
See https://docs.couchdb.org/en/latest/api/server/authn.html#jwt-authentication
func NewAttachment(filename, contentType string, content io.Reader, size ...int64) (*kivik.Attachment, error)
NewAttachment is a convenience function, which sets the size of the attachment based on content. This is intended for creating attachments to be uploaded using multipart/related capabilities of github.com/go-kivik/kivik/v4.DB.Put. The attachment size will be set to the first of the following found:
func OptionFullCommit() kivik.Option
OptionFullCommit is the option key used to set the `X-Couch-Full-Commit` header in the request when set to true.
func OptionHTTPClient(client *http.Client) kivik.Option
OptionHTTPClient may be passed as an option when creating a CouchDB client to specify an custom net/http.Client to be used when making all API calls. Only honored by github.com/go-kivik/kivik/v4.New.
func OptionIfNoneMatch(value string) kivik.Option
OptionIfNoneMatch is an option key to set the `If-None-Match` header on the request.
func OptionNoMultipartGet() kivik.Option
OptionNoMultipartGet instructs github.com/go-kivik/kivik/v4.DB.Get not to use CouchDB's ability to download attachments with the multipart/related media type. This is only honored by calls to github.com/go-kivik/kivik/v4.DB.Get that request attachments.
func OptionNoMultipartPut() kivik.Option
OptionNoMultipartPut instructs github.com/go-kivik/kivik/v4.DB.Put not to use CouchDB's multipart/related upload capabilities. This is only honored by calls to github.com/go-kivik/kivik/v4.DB.Put that also include attachments.
func OptionNoRequestCompression() kivik.Option
OptionNoRequestCompression instructs the CouchDB client not to use gzip compression for request bodies sent to the server. Only honored by github.com/go-kivik/kivik/v4.New.
func OptionPartition(partition string) kivik.Option
OptionPartition instructs supporting methods to limit the query to the specified partition. Supported methods are: Query, AllDocs, Find, and Explain. Only supported by CouchDB 3.0.0 and newer.
See the CouchDB documentation.
func OptionUserAgent(ua string) kivik.Option
OptionUserAgent may be passed as an option when creating a client object, to append to the default User-Agent header sent on all requests.
func ProxyAuth(user, secret string, roles []string, headers ...map[string]string) kivik.Option
ProxyAuth provides support for CouchDB's proxy authentication. Pass this option to github.com/go-kivik/kivik/v4.New to use proxy authentication.
The `secret` argument represents the couch_httpd_auth/secret value configured on the CouchDB server.
If `secret` is the empty string, the X-Auth-CouchDB-Token header will not be set, to support disabling the proxy_use_secret server setting.
The optional `headers` map may be passed to use non-standard header names. For instance, to use `X-User` in place of the `X-Auth-CouchDB-Username` header, pass a value of {"X-Auth-CouchDB-UserName": "X-User"}. The relevant headers are X-Auth-CouchDB-UserName, X-Auth-CouchDB-Roles, and X-Auth-CouchDB-Token.