Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "3.0.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.58.0"),
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.14.0"),
],
targets: [
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,11 @@ The first step to making a query is creating a new `MySQLConnection`. The minimu
```swift
import MySQLNIO

let eventLoop: any EventLoop = ...
let conn = try await MySQLConnection(
to: .makeAddressResolvingHost("my.mysql.server", port: 3306),
username: "test_username",
database: "test_database",
password: "test_password",
on: eventLoop
).get()
```

Expand Down
20 changes: 20 additions & 0 deletions Tests/MySQLNIOTests/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ extension MySQLConnection {
on: eventLoop
)
}

static func connect(
to socketAddress: SocketAddress,
username: String,
database: String,
password: String? = nil,
tlsConfiguration: TLSConfiguration? = .makeClientConfiguration(),
serverHostname: String? = nil,
logger: Logger = .init(label: "codes.vapor.mysql")
) -> EventLoopFuture<MySQLConnection> {
Self.connect(
to: socketAddress,
username: username,
database: database,
password: password,
tlsConfiguration: tlsConfiguration,
serverHostname: serverHostname,
on: MultiThreadedEventLoopGroup.singleton.any()
)
}
}

let isLoggingConfigured: Bool = {
Expand Down