Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#125: Move code into sub-package db #128

Merged
merged 4 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_filenames_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
name-patterns: '*UnitTests.*,*IntegrationTests.*'
paths: '**/src/test/scala/**'
report-format: 'console'
excludes: 'slick/src/test/scala/za/co/absa/fadb/slick/Actor.scala,slick/src/test/scala/za/co/absa/fadb/slick/ActorSlickConverter.scala,slick/src/test/scala/za/co/absa/fadb/slick/SlickTest.scala,doobie/src/test/scala/za/co/absa/fadb/doobie/DoobieTest.scala,slick/src/test/scala/za/co/absa/fadb/slick/OptionalActorSlickConverter.scala'
excludes: '**/src/test/scala/za/co/absa/db/fadb/testing/**'
verbose-logging: 'false'
fail-on-violation: 'true'
34 changes: 15 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,20 @@ lazy val commonJacocoReportSettings: JacocoReportSettings = JacocoReportSettings
)

/**
* add `za.co.absa.fadb.naming.NamingConvention` to filter a class
* or `za.co.absa.fadb.naming.NamingConvention*` to filter the class and all related objects
* add `za.co.absa.db.fadb.naming.NamingConvention` to filter a class
* or `za.co.absa.db.fadb.naming.NamingConvention*` to filter the class and all related objects
*/
lazy val commonJacocoExcludes: Seq[String] = Seq(
)

lazy val commonSettings = Seq(
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
Test / parallelExecution := false,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
jacocoExcludes := commonJacocoExcludes
)

lazy val parent = (project in file("."))
.aggregate(faDbCore, faDBSlick, faDBDoobie)
.settings(
Expand All @@ -59,42 +67,30 @@ lazy val parent = (project in file("."))
)

lazy val faDbCore = (project in file("core"))
.settings(commonSettings: _*)
.settings(
name := "core",
libraryDependencies ++= coreDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:core Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)

lazy val faDBSlick = (project in file("slick"))
.settings(commonSettings: _*)
.settings(
name := "slick",
libraryDependencies ++= slickDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
).dependsOn(faDbCore)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:slick Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)
.dependsOn(faDbCore)

lazy val faDBDoobie = (project in file("doobie"))
.settings(commonSettings: _*)
.settings(
name := "doobie",
libraryDependencies ++= doobieDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
).dependsOn(faDbCore)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:doobie Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)
.dependsOn(faDbCore)

lazy val flywaySettings = project
.enablePlugins(FlywayPlugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import cats.Monad
import cats.implicits.toFunctorOps
import za.co.absa.fadb.status.FailedOrRow
import za.co.absa.db.fadb.status.FailedOrRow

import scala.language.higherKinds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import cats.MonadError
import cats.implicits.toFlatMapOps
import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.handling.StatusHandling
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow, Row}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.handling.StatusHandling
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow, Row}

import scala.language.higherKinds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

/**
* This trait serves the purpose of introducing functions that are common to all DB Function objects and mix-in traits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import za.co.absa.fadb.naming.NamingConvention
import za.co.absa.db.fadb.naming.NamingConvention

/**
* An abstract class, an ancestor to represent a database schema
* The database name of the schema is derived from the class name based on the provided naming convention
* @param schemaNameOverride - in case the class name would not match the database schema name, this gives the
* @param namingConvention - the [[za.co.absa.fadb.naming.NamingConvention NamingConvention]]
* @param namingConvention - the [[za.co.absa.db.fadb.naming.NamingConvention NamingConvention]]
* prescribing how to convert a class name into a db object name
*/
abstract class DBSchema(schemaNameOverride: Option[String] = None)(implicit val namingConvention: NamingConvention) {
Expand All @@ -46,7 +46,7 @@ abstract class DBSchema(schemaNameOverride: Option[String] = None)(implicit val

/**
* Function to convert a class to the associated DB object name, based on the class' name. For transformation from the
* class name to usual db name the schema's [[za.co.absa.fadb.naming.NamingConvention NamingConvention]] is used.
* class name to usual db name the schema's [[za.co.absa.db.fadb.naming.NamingConvention NamingConvention]] is used.
* @param c - class which name to use to get the DB object name
* @return - the db object name
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.status.{FailedOrRow, Row}

/**
* The basis for all query types of [[DBEngine]] implementations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb.exceptions
package za.co.absa.db.fadb.exceptions

/**
* Exception thrown when a naming convention is not found for a given string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.exceptions
package za.co.absa.db.fadb.exceptions

import za.co.absa.fadb.status.FunctionStatus
import za.co.absa.db.fadb.status.FunctionStatus

/**
* Represents an exception that is returned when the function status is not successful.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

import za.co.absa.fadb.exceptions.NamingException
import za.co.absa.db.fadb.exceptions.NamingException

/**
* `ExplicitNamingRequired` is a `NamingConvention` that throws a `NamingConvention` for any string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

/**
* `LettersCase` is a sealed trait that represents different cases of letters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming
package za.co.absa.db.fadb.naming

/**
* `NamingConvention` is a base trait that defines the interface for different naming conventions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming.implementations
package za.co.absa.db.fadb.naming.implementations

import za.co.absa.fadb.naming.{LettersCase, NamingConvention}
import za.co.absa.db.fadb.naming.{LettersCase, NamingConvention}
import LettersCase.AsIs

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.naming.implementations
package za.co.absa.db.fadb.naming.implementations

import za.co.absa.fadb.naming.{LettersCase, NamingConvention}
import za.co.absa.db.fadb.naming.{LettersCase, NamingConvention}
import LettersCase.LowerCase

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation
package za.co.absa.db.fadb.status.aggregation

import za.co.absa.fadb.exceptions.StatusException
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow, Row}
import za.co.absa.db.fadb.exceptions.StatusException
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow, Row}

/**
* `StatusAggregator` is a base trait that defines the interface for aggregating the error statuses of a function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation.implementations
package za.co.absa.db.fadb.status.aggregation.implementations

import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow}

/**
* `ByFirstErrorStatusAggregator` is a trait that extends the `StatusAggregator` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation.implementations
package za.co.absa.db.fadb.status.aggregation.implementations

import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow}

/**
* `ByFirstRowStatusAggregator` is a trait that extends the `StatusAggregator` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.aggregation.implementations
package za.co.absa.db.fadb.status.aggregation.implementations

import za.co.absa.fadb.status.aggregation.StatusAggregator
import za.co.absa.fadb.status.{FailedOrRows, FailedOrRow}
import za.co.absa.db.fadb.status.aggregation.StatusAggregator
import za.co.absa.db.fadb.status.{FailedOrRows, FailedOrRow}

/**
* `ByMajorityErrorsStatusAggregator` is a trait that extends the `StatusAggregator` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.handling
package za.co.absa.db.fadb.status.handling

import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.status.{FailedOrRow, Row}

/**
* `StatusHandling` is a base trait that defines the interface for handling the status of a function invocation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.handling.implementations
package za.co.absa.db.fadb.status.handling.implementations

import za.co.absa.fadb.exceptions._
import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.fadb.status.handling.StatusHandling
import za.co.absa.db.fadb.exceptions._
import za.co.absa.db.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.status.handling.StatusHandling

/**
* `StandardStatusHandling` is a trait that extends the `StatusHandling` interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package za.co.absa.fadb.status.handling.implementations
package za.co.absa.db.fadb.status.handling.implementations

import za.co.absa.fadb.exceptions.OtherStatusException
import za.co.absa.fadb.status.handling.StatusHandling
import za.co.absa.fadb.status.{FailedOrRow, Row}
import za.co.absa.db.fadb.exceptions.OtherStatusException
import za.co.absa.db.fadb.status.handling.StatusHandling
import za.co.absa.db.fadb.status.{FailedOrRow, Row}

/**
* Trait represents user defined status handling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import za.co.absa.fadb.exceptions.StatusException
import za.co.absa.db.fadb.exceptions.StatusException

package object status {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package za.co.absa.fadb
package za.co.absa.db.fadb

import org.scalatest.funsuite.AnyFunSuiteLike

import za.co.absa.fadb.naming.implementations.SnakeCaseNaming.Implicits._
import za.co.absa.db.fadb.naming.implementations.SnakeCaseNaming.Implicits._

class DBFunctionFabricUnitTests extends AnyFunSuiteLike {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import cats.MonadError
import cats.implicits._
import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.fadb.DBFunction.DBSingleResultFunction
import za.co.absa.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention
import za.co.absa.fadb.status.FailedOrRow
import za.co.absa.db.fadb.DBFunction.DBSingleResultFunction
import za.co.absa.db.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention
import za.co.absa.db.fadb.status.FailedOrRow

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* limitations under the License.
*/

package za.co.absa.fadb
package za.co.absa.db.fadb

import org.scalatest.funsuite.AnyFunSuite
import za.co.absa.fadb.naming.NamingConvention
import za.co.absa.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention
import za.co.absa.db.fadb.naming.NamingConvention
import za.co.absa.db.fadb.naming.implementations.SnakeCaseNaming.Implicits.namingConvention

class DBSchemaUnitTests extends AnyFunSuite {

Expand Down
Loading
Loading