Skip to content

Commit f4e7b9f

Browse files
committed
3.0 dep updates
1 parent 220fae2 commit f4e7b9f

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

Package.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ let package = Package(
88
],
99
dependencies: [
1010
// Swift Promises, Futures, and Streams.
11-
.package(url: "https://github.com/vapor/async.git", .branch("beta")),
11+
.package(url: "https://github.com/vapor/async.git", .exact("1.0.0-beta.1")),
1212

1313
// Core extensions, type-aliases, and functions that facilitate common tasks.
14-
.package(url: "https://github.com/vapor/core.git", .branch("beta")),
14+
.package(url: "https://github.com/vapor/core.git", .exact("3.0.0-beta.1")),
1515

1616
// Cryptography modules (formerly CryptoKitten)
17-
.package(url: "https://github.com/vapor/crypto.git", .branch("beta")),
17+
.package(url: "https://github.com/vapor/crypto.git", .exact("3.0.0-beta.1")),
1818

1919
// Core services for creating database integrations.
20-
.package(url: "https://github.com/vapor/database-kit.git", .branch("beta")),
20+
.package(url: "https://github.com/vapor/database-kit.git", .exact("1.0.0-beta.1")),
2121

2222
// Non-blocking networking for Swift (HTTP and WebSockets).
23-
.package(url: "https://github.com/vapor/engine.git", .branch("beta")),
23+
.package(url: "https://github.com/vapor/engine.git", .exact("3.0.0-beta.1")),
2424

2525
// Service container and configuration system.
26-
.package(url: "https://github.com/vapor/service.git", .branch("beta")),
26+
.package(url: "https://github.com/vapor/service.git", .exact("1.0.0-beta.1")),
2727

2828
// Pure Swift (POSIX) TCP and UDP non-blocking socket layer, with event-driven Server and Client.
29-
.package(url: "https://github.com/vapor/sockets.git", .branch("beta")),
29+
.package(url: "https://github.com/vapor/sockets.git", .exact("3.0.0-beta.1")),
3030
],
3131
targets: [
3232
.target(name: "PostgreSQL", dependencies: ["Async", "Bits", "Crypto", "DatabaseKit", "Service", "TCP"]),

Sources/PostgreSQL/Connection/PostgreSQLConnection+TCP.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ extension PostgreSQLConnection {
66
public static func connect(
77
hostname: String = "localhost",
88
port: UInt16 = 5432,
9-
on worker: Worker
9+
on worker: Worker,
10+
onError: @escaping TCPSocketSink.ErrorHandler
1011
) throws -> PostgreSQLConnection {
1112
let socket = try TCPSocket(isNonBlocking: true)
1213
let client = try TCPClient(socket: socket)
1314
try client.connect(hostname: hostname, port: port)
14-
return PostgreSQLConnection(stream: socket.stream(on: worker), on: worker)
15+
let stream = socket.stream(on: worker, onError: onError)
16+
return PostgreSQLConnection(stream: stream, on: worker)
1517
}
1618
}

Sources/PostgreSQL/Database/PostgreSQLDatabase.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public final class PostgreSQLDatabase: Database {
1616
/// See `Database.makeConnection()`
1717
public func makeConnection(using connectionConfig: PostgreSQLConnectionConfig, on worker: Worker) -> Future<PostgreSQLConnection> {
1818
do {
19-
let client = try PostgreSQLConnection.connect(hostname: config.hostname, port: config.port, on: worker)
19+
let client = try PostgreSQLConnection.connect(hostname: config.hostname, port: config.port, on: worker) { _, error in
20+
print("[PostgreSQL] \(error)")
21+
}
2022
client.logger = logger
2123
return client.authenticate(
2224
username: config.username,

Tests/PostgreSQLTests/PostgreSQLConnectionTests.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ extension PostgreSQLConnection {
284284
/// Creates a test event loop and psql client.
285285
static func makeTest() throws -> (PostgreSQLConnection, EventLoop) {
286286
let eventLoop = try DefaultEventLoop(label: "codes.vapor.postgresql.client.test")
287-
let client = try PostgreSQLConnection.connect(on: eventLoop)
287+
let client = try PostgreSQLConnection.connect(on: eventLoop) { _, error in
288+
XCTFail("\(error)")
289+
}
288290
_ = try client.authenticate(username: "postgres").await(on: eventLoop)
289291
return (client, eventLoop)
290292
}

0 commit comments

Comments
 (0)