Protocol
CouchDBRepresentable
A protocol representing an object that can be stored in a CouchDB database. Conforming types must support Codable and Sendable for serialization and thread safety. Every CouchDB document should have _id and _rev properties. Unfortunately DocC ignores properties starting with _ symbol so check the example in the Overview section.
protocol CouchDBRepresentable : Decodable, Encodable, Sendable
Overview
Example:
// Example struct
struct ExpectedDoc: CouchDBRepresentable {
var name: String
var _id: String = NSUUID().uuidString
var _rev: String?
func updateRevision(_ newRevision: String) -> Self {
return ExpectedDoc(name: name, _id: _id, _rev: newRevision)
}
}
Topics
Instance Methods