| 32 | } |
| 33 | |
| 34 | export class MssqlContainer extends Context.Tag("test/MssqlContainer")< |
| 35 | MssqlContainer, |
| 36 | StartedMSSQLServerContainer |
| 37 | >() { |
| 38 | static Live = Layer.scoped( |
| 39 | this, |
| 40 | Effect.acquireRelease( |
| 41 | Effect.promise(() => new MSSQLServerContainer().acceptLicense().start()), |
| 42 | (container) => Effect.promise(() => container.stop()) |
| 43 | ) |
| 44 | ) |
| 45 | |
| 46 | static ClientLive = Layer.unwrapEffect( |
| 47 | Effect.gen(function*() { |
| 48 | const container = yield* MssqlContainer |
| 49 | return Mssql.MssqlClient.layer({ |
| 50 | server: container.getHost(), |
| 51 | port: container.getPort(), |
| 52 | username: container.getUsername(), |
| 53 | password: Redacted.make(container.getPassword()), |
| 54 | database: container.getDatabase() |
| 55 | }) |
| 56 | }) |
| 57 | ).pipe(Layer.provide(this.Live)) |
| 58 | } |
| 59 | |
| 60 | export class MysqlContainer extends Context.Tag("test/MysqlContainer")< |
| 61 | MysqlContainer, |