|
16 | 16 | package scalikejdbc.async.internal
|
17 | 17 |
|
18 | 18 | import com.github.jasync.sql.db.Configuration
|
19 |
| -import scalikejdbc.JDBCUrl |
20 | 19 | import scalikejdbc.async.AsyncConnectionSettings
|
21 | 20 |
|
22 | 21 | /**
|
23 | 22 | * Configuration attribute
|
24 | 23 | */
|
25 | 24 | private[scalikejdbc] trait JasyncConfiguration {
|
26 | 25 |
|
| 26 | + @deprecated("Will be removed in the future", "0.16.0") |
27 | 27 | val defaultConfiguration = new Configuration("")
|
28 | 28 |
|
| 29 | + protected def parseUrl(url: String): Configuration |
| 30 | + |
29 | 31 | private[scalikejdbc] def configuration(
|
30 | 32 | url: String,
|
31 | 33 | user: String,
|
32 | 34 | password: String,
|
33 | 35 | connectionSettings: AsyncConnectionSettings
|
34 | 36 | ) = {
|
35 |
| - val jdbcUrl = JDBCUrl(url) |
36 |
| - new Configuration( |
| 37 | + val baseConf = parseUrl(url) |
| 38 | + baseConf.copy( |
37 | 39 | user,
|
38 |
| - jdbcUrl.host, |
39 |
| - jdbcUrl.port, |
| 40 | + baseConf.getHost, |
| 41 | + baseConf.getPort, |
40 | 42 | password,
|
41 |
| - jdbcUrl.database, |
42 |
| - connectionSettings.ssl.getOrElse(defaultConfiguration.getSsl), |
43 |
| - connectionSettings.charset.getOrElse(defaultConfiguration.getCharset), |
| 43 | + baseConf.getDatabase, |
| 44 | + connectionSettings.ssl.getOrElse(baseConf.getSsl), |
| 45 | + connectionSettings.charset.getOrElse(baseConf.getCharset), |
44 | 46 | connectionSettings.maximumMessageSize.getOrElse(
|
45 |
| - defaultConfiguration.getMaximumMessageSize |
| 47 | + baseConf.getMaximumMessageSize |
46 | 48 | ),
|
47 |
| - connectionSettings.allocator.getOrElse(defaultConfiguration.getAllocator), |
| 49 | + connectionSettings.allocator.getOrElse(baseConf.getAllocator), |
48 | 50 | connectionSettings.connectTimeout
|
49 | 51 | .map(_.toMillis.toInt)
|
50 |
| - .getOrElse(defaultConfiguration.getConnectionTimeout), |
| 52 | + .getOrElse(baseConf.getConnectionTimeout), |
51 | 53 | connectionSettings.queryTimeout
|
52 | 54 | .map(x => java.time.Duration.ofMillis(x.toMillis))
|
53 |
| - .getOrElse(defaultConfiguration.getQueryTimeout), |
54 |
| - defaultConfiguration.getApplicationName, |
55 |
| - defaultConfiguration.getInterceptors, |
56 |
| - defaultConfiguration.getEventLoopGroup, |
57 |
| - defaultConfiguration.getExecutionContext |
| 55 | + .getOrElse(baseConf.getQueryTimeout), |
| 56 | + baseConf.getApplicationName, |
| 57 | + baseConf.getInterceptors, |
| 58 | + baseConf.getEventLoopGroup, |
| 59 | + baseConf.getExecutionContext, |
| 60 | + baseConf.getCurrentSchema, |
| 61 | + baseConf.getSocketPath, |
58 | 62 | )
|
59 | 63 | }
|
60 | 64 |
|
|
0 commit comments