ptrdom commented on code in PR #194: URL: https://github.com/apache/pekko-persistence-r2dbc/pull/194#discussion_r2174987367
########## core/src/main/scala/org/apache/pekko/persistence/r2dbc/R2dbcSettings.scala: ########## @@ -16,107 +16,219 @@ package org.apache.pekko.persistence.r2dbc import java.util.Locale import scala.concurrent.duration._ - import org.apache.pekko import pekko.annotation.InternalApi import pekko.annotation.InternalStableApi +import pekko.util.Helpers.toRootLowerCase import pekko.util.JavaDurationConverters._ import com.typesafe.config.Config -import pekko.util.Helpers.toRootLowerCase /** * INTERNAL API */ @InternalStableApi -object R2dbcSettings { - def apply(config: Config): R2dbcSettings = - new R2dbcSettings(config) +sealed trait Dialect + +/** + * INTERNAL API + */ +@InternalStableApi +object Dialect { + case object Postgres extends Dialect + case object Yugabyte extends Dialect + + /** @since 1.1.0 */ + case object MySQL extends Dialect + + /** @since 1.1.0 */ + def fromString(value: String): Dialect = { + toRootLowerCase(value) match { + case "yugabyte" => Dialect.Yugabyte + case "postgres" => Dialect.Postgres + case "mysql" => Dialect.MySQL + case other => + throw new IllegalArgumentException( + s"Unknown dialect [$other]. Supported dialects are [yugabyte, postgres, mysql].") + } + } } /** * INTERNAL API */ @InternalStableApi -final class R2dbcSettings(config: Config) { - val schema: Option[String] = Option(config.getString("schema")).filterNot(_.trim.isEmpty) +final class JournalSettings(val config: Config) extends ConnectionSettings with UseConnnectionFactory with BufferSize Review Comment: I would prefer to keep this a multi-unit file, though unsure about the naming in that case. `r2dbcSettings.scala`? @pjfanning do you have a preferred solution? In my option keeping the old name is not an option for the journal class, it was not named well to begin with - too general. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org