Skip to content

Map PSQL enum with Kotlin enum #1046

Answered by nakamura-to
Distractic asked this question in Q&A
Discussion options

You must be logged in to vote

R2dbcDatabase can receive a PostgresqlConnectionFactory.
Try the following code:

    @BeforeTest
    fun onBefore() = runBlocking {
        database = R2dbcDatabase(
            connectionFactory = createPostgresqlConnectionFactory(psqlContainer), 
            dialect = PostgreSqlR2dbcDialect()
        )
    }

    fun createPostgresqlConnectionFactory(container: PostgreSQLContainer<*>): PostgresqlConnectionFactory {
        val options = createConnectionOptions(container)
        val configuration =
            PostgresqlConnectionFactoryProvider.builder(options)
                .codecRegistrar(EnumCodec.builder().withEnum("rank", Rank::class.java).build())
                .build()
        

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@Distractic
Comment options

@nakamura-to
Comment options

@Distractic
Comment options

@nakamura-to
Comment options

Answer selected by Distractic
@Distractic
Comment options

@nakamura-to
Comment options

@Distractic
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants