Skip to content

Instantly share code, notes, and snippets.

View achinaou's full-sized avatar

Achilleas Naoumidis achinaou

View GitHub Profile
@achinaou
achinaou / FlywayTestAspect.scala
Last active October 31, 2025 15:08
Flyway ZIO Test Aspect
import javax.sql.DataSource
import org.flywaydb.core.Flyway
import org.flywaydb.core.api.configuration.FluentConfiguration
import org.flywaydb.core.api.output.MigrateResult
import zio.ZIO
import zio.test.TestAspect
object FlywayTestAspect:
@achinaou
achinaou / PostgreSQLContainer.scala
Last active October 31, 2025 14:00
PostgreSQL Test Container ZIO Layer
import java.sql.Connection
import javax.sql.DataSource
import org.postgresql.ds.PGSimpleDataSource
import org.testcontainers.containers.PostgreSQLContainer as OriginalPostgreSQLContainer
import zio.Scope
import zio.ZIO
import zio.ZLayer
class PostgreSQLContainer(dockerImageName: String)
const identity = x => x
const of = x => [x]
const empty = () => []
const concat = (xs, ys) => [...xs, ...ys]
const foldRight = f => acc => ([x, ...xs]) => x
? f(x, foldRight(f)(acc)(xs))