File tree 1 file changed +8
-7
lines changed
Sources/PostgreSQL/Database
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,13 @@ public struct PostgreSQLDatabaseConfig {
31
31
self . password = password
32
32
}
33
33
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,
40
41
database. count > 0
41
42
else {
42
43
throw PostgreSQLError ( identifier: " Bad Connection String " ,
@@ -49,6 +50,6 @@ public struct PostgreSQLDatabaseConfig {
49
50
self . port = port
50
51
self . username = username
51
52
self . database = database
52
- self . password = url . password
53
+ self . password = urL . password
53
54
}
54
55
}
You can’t perform that action at this time.
0 commit comments