Skip to content

Commit bd3d280

Browse files
author
Shaun Hubbard
committed
changed method signature, per @tanner0101
1 parent 7a50dfd commit bd3d280

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Sources/PostgreSQL/Database/PostgreSQLDatabaseConfig.swift

+8-7
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ public struct PostgreSQLDatabaseConfig {
3131
self.password = password
3232
}
3333

34-
public init(connectionString: String) throws {
35-
guard let url = URL(string: connectionString),
36-
let hostname = url.host,
37-
let port = url.port,
38-
let username = url.user,
39-
let database = URL(string: connectionString)?.path,
34+
/// Creates a `PostgreSQLDatabaseConfig` frome a connection string.
35+
public init(url: String) throws {
36+
guard let urL = URL(string: url),
37+
let hostname = urL.host,
38+
let port = urL.port,
39+
let username = urL.user,
40+
let database = URL(string: url)?.path,
4041
database.count > 0
4142
else {
4243
throw PostgreSQLError(identifier: "Bad Connection String",
@@ -49,6 +50,6 @@ public struct PostgreSQLDatabaseConfig {
4950
self.port = port
5051
self.username = username
5152
self.database = database
52-
self.password = url.password
53+
self.password = urL.password
5354
}
5455
}

0 commit comments

Comments
 (0)