Structures

The following structures are available globally.

  • A struct representing the JSON response from CouchDB when an error occurs.

    CouchDB reference: CouchDB_Error_Status

    See more

    Declaration

    Swift

    public struct CouchDBError: Codable, Swift.Error, CustomStringConvertible
  • A struct representing the JSON returned when querying a Database or View. If includeDocuments was true for the query, each row will have an additional doc field containing the JSON document. These documents can then be decoded to a given Swift type using decodeDocuments(ofType:).

    CouchDB reference: All_Database_Documents

    Usage Example:

    struct MyDocument: Document {
        let _id: String?
        var _rev: String?
        var value: String
    }
    database.retrieveAll(includeDocuments: true) { (allDocs, error) in
        if let allDocs = allDocs,
           let decodedDocs = allDocs.decodeDocuments(ofType: MyDocument)
        {
            for doc in decodedDocs {
               print("Retrieved MyDocument with value: \(doc.value)")
            }
        }
    }
    
    See more

    Declaration

    Swift

    public struct AllDatabaseDocuments
  • A struct representing an array of JSON documents. This is used for adding or updating multiple documents at once using the bulk api.

    CouchDB reference: /db/_bulk_docs

    See more

    Declaration

    Swift

    public struct BulkDocuments
  • A struct representing an item in the response JSON Array of Objects from an HTTP request to the _bulk_docs API.

    CouchDB reference: /db/_bulk_docs

    See more

    Declaration

    Swift

    public struct BulkResponse: Codable
  • This struct represents the agreed upon fields and structure of a design documents. The filters, lists, shows and updates fields objects are mapping of function name to string function source code. The views mapping is the same except that values are objects with map and reduce (optional) keys which also contains functions source code.

    CouchDB reference: /db/_design/design-doc

    See more

    Declaration

    Swift

    public struct DesignDocument: Document
  • A struct representing the response from a request to insert, update or delete a Document.

    CouchDB reference: /db/doc

    See more

    Declaration

    Swift

    public struct DocumentResponse: Codable