Skip to content

Commit

Permalink
Reorganizes imports
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelrenoux committed Jun 12, 2021
1 parent febba6e commit 5688c86
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.github.gaelrenoux.tranzactio

import java.sql.Connection

import javax.sql.DataSource
import zio._
import zio.blocking._
import zio.clock.Clock

import java.sql.Connection
import javax.sql.DataSource

/** A module able to provide and manage connections. They typically come from a connection pool. */
object ConnectionSource {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.github.gaelrenoux.tranzactio

import java.sql.{Connection => JdbcConnection}

import javax.sql.DataSource
import zio.blocking.Blocking
import zio.clock.Clock
import zio.{Has, Tag, ZIO, ZLayer}

import java.sql.{Connection => JdbcConnection}
import javax.sql.DataSource

/** Template implementing the commodity methods for a Db module. */
abstract class DatabaseModuleBase[Connection, Dbs <: DatabaseOps.ServiceOps[Connection] : Tag]
extends DatabaseOps.ModuleOps[Connection, Dbs] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.github.gaelrenoux.tranzactio

import java.sql.{Connection => JdbcConnection}

import zio.{Has, Tag, ZIO}

import java.sql.{Connection => JdbcConnection}


/** Template implementing a default transactional mechanism, based on a ConnectionSource. */
abstract class DatabaseServiceBase[Connection <: Has[_] : Tag](connectionSource: ConnectionSource.Service)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package io.github.gaelrenoux.tranzactio

import java.sql.{Connection => JdbcConnection}

import io.github.gaelrenoux.tranzactio.test.DatabaseModuleTestOps
import izumi.reflect.Tag
import zio.blocking.{Blocking, effectBlocking}
import zio.{Has, ZIO, ZLayer}

import java.sql.{Connection => JdbcConnection}


/** TranzactIO module for Anorm. Note that the 'Connection' also includes the Blocking module, as tzio also needs to
* provide the wrapper around the synchronous Anorm method. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.github.gaelrenoux.tranzactio

import java.sql.{Connection => JdbcConnection}

import _root_.doobie.free.KleisliInterpreter
import _root_.doobie.util.transactor.{Strategy, Transactor}
import cats.effect.Resource
Expand All @@ -14,6 +12,8 @@ import zio.stream.ZStream
import zio.stream.interop.fs2z._
import zio.{Has, Task, ZIO, ZLayer}

import java.sql.{Connection => JdbcConnection}


/** TranzactIO module for Doobie. */
package object doobie extends Wrapper {
Expand Down
3 changes: 2 additions & 1 deletion src/samples/scala/samples/ConnectionPool.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package samples

import javax.sql.DataSource
import org.h2.jdbcx.JdbcDataSource
import zio.blocking.Blocking
import zio.{Has, ZIO, ZLayer, blocking}

import javax.sql.DataSource

/**
* Typically, you would use a Connection Pool like HikariCP. Here, we're just gonna use the JDBC H2 datasource directly.
* Don't do that in production !
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.github.gaelrenoux.tranzactio

import java.sql.{Connection, DriverManager}
import java.util.UUID

import javax.sql.DataSource
import org.h2.jdbcx.JdbcDataSource
import zio.blocking.Blocking
import zio.test.environment.testEnvironment
import zio.{Has, ULayer, ZLayer, blocking}

import java.sql.{Connection, DriverManager}
import java.util.UUID
import javax.sql.DataSource

object JdbcLayers {
/** Generates the DataSource layer.
*
Expand Down

0 comments on commit 5688c86

Please sign in to comment.