File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
doobie-hikari-pureconfig/src/main/scala/com/avast/sst/doobie/pureconfig Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11package com .avast .sst .doobie .pureconfig
22
3+ import cats .syntax .either ._
34import com .avast .sst .doobie .DoobieHikariConfig
45import doobie .enum .TransactionIsolation
56import pureconfig .ConfigReader
6- import pureconfig .generic .semiauto .{deriveEnumerationReader , deriveReader }
7+ import pureconfig .error .CannotConvert
8+ import pureconfig .generic .semiauto .deriveReader
79
810trait ConfigReaders {
911
10- implicit val transactionIsolationReader : ConfigReader [TransactionIsolation ] = deriveEnumerationReader
12+ implicit val transactionIsolationReader : ConfigReader [TransactionIsolation ] = ConfigReader [String ].emap {
13+ case " TRANSACTION_NONE" => TransactionIsolation .TransactionNone .asRight
14+ case " TRANSACTION_READ_UNCOMMITTED" => TransactionIsolation .TransactionReadUncommitted .asRight
15+ case " TRANSACTION_READ_COMMITTED" => TransactionIsolation .TransactionReadCommitted .asRight
16+ case " TRANSACTION_REPEATABLE_READ" => TransactionIsolation .TransactionRepeatableRead .asRight
17+ case " TRANSACTION_SERIALIZABLE" => TransactionIsolation .TransactionSerializable .asRight
18+ case unknown => Left (CannotConvert (unknown, " TransactionIsolation" , " unknown value" ))
19+ }
1120
1221 implicit val configReader : ConfigReader [DoobieHikariConfig ] = deriveReader
1322
You can’t perform that action at this time.
0 commit comments