@@ -9,6 +9,7 @@ import PostgresNIO
99public struct PoolConfiguration {
1010
1111 /// PostgreSQL connection parameters.
12+ @available ( * , deprecated, message: " Use `PostgresConnection.Configuration` etc. instead. " )
1213 public struct Connection {
1314 let username : String
1415 let password : String
@@ -35,7 +36,7 @@ public struct PoolConfiguration {
3536 public let applicationName : String
3637
3738 /// Connection parameters to the database.
38- public let connection : Connection
39+ public let postgresConfiguration : PostgresConnection . Configuration
3940
4041 /// Timeout for opening new connections to the PostgreSQL database, in seconds (default: 5 seconds).
4142 public let connectTimeout : TimeInterval
@@ -64,14 +65,14 @@ public struct PoolConfiguration {
6465
6566 public init (
6667 applicationName: String ,
67- connection : Connection ,
68+ postgresConfiguration : PostgresConnection . Configuration ,
6869 connectTimeout: TimeInterval = 5.0 ,
6970 queryTimeout: TimeInterval ? = nil ,
7071 poolSize: Int = 10 ,
7172 maxIdleConnections: Int ? = nil )
7273 {
7374 self . applicationName = applicationName
74- self . connection = connection
75+ self . postgresConfiguration = postgresConfiguration
7576 self . connectTimeout = connectTimeout. atLeast ( 1.0 )
7677 self . queryTimeout = queryTimeout? . atLeast ( 1.0 )
7778 self . poolSize = poolSize. atLeast ( 1 )
@@ -82,4 +83,28 @@ public struct PoolConfiguration {
8283 }
8384 }
8485
86+ @available ( * , deprecated, message: " Use `init(applicationName:postgresConfiguration:connectTimeout:queryTimeout:poolSize:maxIdleConnections:)` instead. " )
87+ public init (
88+ applicationName: String ,
89+ connection: Connection ,
90+ connectTimeout: TimeInterval = 5.0 ,
91+ queryTimeout: TimeInterval ? = nil ,
92+ poolSize: Int = 10 ,
93+ maxIdleConnections: Int ? = nil )
94+ {
95+ let postgresConfiguration = PostgresConnection . Configuration (
96+ host: connection. host,
97+ port: connection. port,
98+ username: connection. username,
99+ password: connection. password,
100+ database: connection. database,
101+ tls: . disable)
102+ self . init ( applicationName: applicationName,
103+ postgresConfiguration: postgresConfiguration,
104+ connectTimeout: connectTimeout,
105+ queryTimeout: queryTimeout,
106+ poolSize: poolSize,
107+ maxIdleConnections: maxIdleConnections)
108+ }
109+
85110}
0 commit comments