Skip to content

Commit fb6e880

Browse files
makonigevartosky
andauthored
2.0.1 (#27)
* swift-docc-plugin 1.3.0 * async-http-client 1.19.0 * replaced deprecated .createNew with the new .singleton * Adding _find capability. (#13) * docs * tabs * renames * added test for find method with body * docs added * findError added * tests renamed * added test for find method with generic type * docs * README updated * updated dependencies * docs updated * try Swift 5.7.1 * Update build-ubuntu.yml * Swift 5.7.3 * Revert "Swift 5.7.3" This reverts commit ab8f67a. * updated dependencies * Docs updated * Delete .github/workflows/CodeQL.yml * dependencies updated * fixed when update method didn’t use passed dateEncodingStrategy * noData error added * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * … * migrating to new HTTPClientRequest from HTTPClient.Request wip * rename * tests updated * auth fixed * collect body bytes before returning response * param renamed to make keep backward compatibility with old methods * marking old find as deprecated * private * deprecated message * renames * moved deprecations * docs * docs * added Codable to CouchDBRepresentable protocol * added RowsResponse model * docs * Vapor tutorial updated * docs * docs and refactoring * docs and refactoring * Tutorials updated * docs * platforms list updated * minimum swift version 5.8 * workflow updated * Update build-ubuntu.yml * Update build-macos.yml * import NIOFoundationCompat to fix building on Ubuntu * using async-http-client from 1.21.0. Not calling http * Using HTTPClient.shared if eventLoopGroup not provided. No more calls httpClient.syncShutdown() if using shared singleton * docs updated * docs updated * Vapor tutorial updated * A SwiftUI tutorial * tutorial fixed * updated dependencies * Package.resolved * docs updated * userName param is now required for CouchDB init * cleanup * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * docs * dependencices updated * updated swift-docc-plugin URL. Updated dependencies to latest versions. * Update build-ubuntu.yml * dependencies updated * deleted deprecated methods * Sendable conformance * swift-format added * formatting * formatting * revert sendable * updated dependencies * Sensable conformance * updated CouchDBRepresentable protocol * Sendable conformance * Strict concurrency implemented * Swift 6 * docs updated * errors and docs * docs * docs * docs wip * docs * wip * wip * docs * docs * get only _rev * tutorials updated * docs * Update README.md * Update README.md * updated GitHub actions configs * dependencies updated * updated docs * code formatting --------- Co-authored-by: Gregório Gevartosky Torrezan <[email protected]>
1 parent 84367ef commit fb6e880

File tree

8 files changed

+125
-121
lines changed

8 files changed

+125
-121
lines changed

Package.resolved

Lines changed: 21 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let package = Package(
88
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)],
99
products: [
1010
// Products define the executables and libraries a package produces, and make them visible to other packages.
11-
.library(name: "CouchDBClient", targets: ["CouchDBClient"]),
11+
.library(name: "CouchDBClient", targets: ["CouchDBClient"])
1212
],
1313
dependencies: [
1414
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.21.0"),
@@ -24,6 +24,6 @@ let package = Package(
2424
]),
2525
.testTarget(
2626
name: "CouchDBClientTests",
27-
dependencies: ["CouchDBClient"]),
27+
dependencies: ["CouchDBClient"])
2828
]
2929
)

Sources/CouchDBClient/CouchDBClient.docc/Extensions/Client.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A CouchDB client class with methods using Swift Concurrency.
99
## Topics
1010

1111
### Initializer
12-
- ``init(couchProtocol:couchHost:couchPort:userName:userPassword:)``
12+
- ``init(config:)``
1313

1414
### Methods for databases
1515
- ``getAllDBs(eventLoopGroup:)``
@@ -31,9 +31,3 @@ A CouchDB client class with methods using Swift Concurrency.
3131
- ``find(inDB:selector:dateDecodingStrategy:eventLoopGroup:)``
3232
- ``delete(fromDb:doc:eventLoopGroup:)``
3333
- ``delete(fromDb:uri:rev:eventLoopGroup:)``
34-
35-
### Deprecated methods
36-
- ``get(dbName:uri:queryItems:eventLoopGroup:)``
37-
- ``get(dbName:uri:queryItems:dateDecodingStrategy:eventLoopGroup:)``
38-
- ``find(in:body:eventLoopGroup:)``
39-
- ``find(in:selector:dateDecodingStrategy:eventLoopGroup:)``
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Task {
2-
var doc = MyDoc(title: "My Document")
3-
4-
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
5-
print(doc)
6-
7-
doc.title = "Updated title"
8-
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
9-
print(doc)
10-
11-
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
12-
print(docFromDB)
13-
14-
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
2+
var doc = MyDoc(title: "My Document")
3+
4+
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
5+
print(doc)
6+
7+
doc.title = "Updated title"
8+
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
9+
print(doc)
10+
11+
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
12+
print(docFromDB)
13+
14+
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
1515
}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
Task {
2-
var doc = MyDoc(title: "My Document")
3-
4-
do {
5-
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
6-
} catch CouchDBClientError.insertError(let error) {
7-
print(error.reason)
8-
return
9-
} catch {
10-
print(error.localizedDescription)
11-
return
12-
}
13-
print(doc)
14-
15-
doc.title = "Updated title"
16-
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
17-
print(doc)
18-
19-
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
20-
print(docFromDB)
21-
22-
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
2+
var doc = MyDoc(title: "My Document")
3+
4+
do {
5+
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
6+
} catch CouchDBClientError.insertError(let error) {
7+
print(error.reason)
8+
return
9+
} catch {
10+
print(error.localizedDescription)
11+
return
12+
}
13+
print(doc)
14+
15+
doc.title = "Updated title"
16+
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
17+
print(doc)
18+
19+
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
20+
print(docFromDB)
21+
22+
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
2323
}
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
Task {
2-
var doc = MyDoc(title: "My Document")
3-
4-
do {
5-
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
6-
} catch CouchDBClientError.insertError(let error) {
7-
print(error.reason)
8-
return
9-
} catch {
10-
print(error.localizedDescription)
11-
return
12-
}
13-
print(doc)
14-
15-
doc.title = "Updated title"
16-
do {
17-
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
18-
} catch CouchDBClientError.updateError(let error) {
19-
print(error.reason)
20-
return
21-
} catch {
22-
print(error.localizedDescription)
23-
return
24-
}
25-
print(doc)
26-
27-
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
28-
print(docFromDB)
29-
30-
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
2+
var doc = MyDoc(title: "My Document")
3+
4+
do {
5+
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
6+
} catch CouchDBClientError.insertError(let error) {
7+
print(error.reason)
8+
return
9+
} catch {
10+
print(error.localizedDescription)
11+
return
12+
}
13+
print(doc)
14+
15+
doc.title = "Updated title"
16+
do {
17+
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
18+
} catch CouchDBClientError.updateError(let error) {
19+
print(error.reason)
20+
return
21+
} catch {
22+
print(error.localizedDescription)
23+
return
24+
}
25+
print(doc)
26+
27+
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
28+
print(docFromDB)
29+
30+
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
3131
}
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
Task {
2-
var doc = MyDoc(title: "My Document")
3-
4-
do {
5-
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
6-
} catch CouchDBClientError.insertError(let error) {
7-
print(error.reason)
8-
return
9-
} catch {
10-
print(error.localizedDescription)
11-
return
12-
}
13-
print(doc)
14-
15-
doc.title = "Updated title"
16-
do {
17-
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
18-
} catch CouchDBClientError.updateError(let error) {
19-
print(error.reason)
20-
return
21-
} catch {
22-
print(error.localizedDescription)
23-
return
24-
}
25-
print(doc)
26-
27-
do {
28-
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
29-
} catch CouchDBClientError.getError(let error) {
30-
print(error.reason)
31-
return
32-
} catch {
33-
print(error.localizedDescription)
34-
return
35-
}
36-
print(docFromDB)
37-
38-
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
2+
var doc = MyDoc(title: "My Document")
3+
4+
do {
5+
doc = try await couchDBClient.insert(dbName: dbName, doc: doc)
6+
} catch CouchDBClientError.insertError(let error) {
7+
print(error.reason)
8+
return
9+
} catch {
10+
print(error.localizedDescription)
11+
return
12+
}
13+
print(doc)
14+
15+
doc.title = "Updated title"
16+
do {
17+
doc = try await couchDBClient.update(dbName: dbName, doc: doc)
18+
} catch CouchDBClientError.updateError(let error) {
19+
print(error.reason)
20+
return
21+
} catch {
22+
print(error.localizedDescription)
23+
return
24+
}
25+
print(doc)
26+
27+
do {
28+
let docFromDB: MyDoc = try await couchDBClient.get(fromDB: dbName, uri: doc._id)
29+
} catch CouchDBClientError.getError(let error) {
30+
print(error.reason)
31+
return
32+
} catch {
33+
print(error.localizedDescription)
34+
return
35+
}
36+
print(docFromDB)
37+
38+
let deleteResponse = try await couchDBClient.delete(fromDb: dbName, doc: doc)
3939
}

Tests/CouchDBClientTests/CouchDBClientTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class CouchDBClientTests: XCTestCase {
2323
couchPort: 5984,
2424
userName: "admin",
2525
userPassword: ProcessInfo.processInfo.environment["COUCHDB_PASS"] ?? "",
26-
requestsTimeout: 30
26+
requestsTimeout: 30
2727
)
2828

2929
lazy var couchDBClient = CouchDBClient(config: config)

0 commit comments

Comments
 (0)