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

streaming functions for doobie and slick with tests #108

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
91f4e39
#99: DBEngine requirement removed from DBSchema. Fixes #99.
salamonpavel Nov 30, 2023
5045b8a
#99: Added DBSchema tests in order to increase code coverage.
salamonpavel Dec 1, 2023
15e9603
tmp code of doobie integration
salamonpavel Dec 2, 2023
264f510
tmp code of doobie integration
salamonpavel Dec 3, 2023
27fac52
tmp code of doobie integration
salamonpavel Dec 4, 2023
c1baa58
it example, status handling (extends not the implementation)
salamonpavel Dec 4, 2023
d12d96a
integration tests
salamonpavel Dec 4, 2023
804035d
integration tests
salamonpavel Dec 4, 2023
d83b274
minors
salamonpavel Dec 5, 2023
491e235
enceladus example fixed
salamonpavel Dec 5, 2023
088065f
build related
salamonpavel Dec 5, 2023
d766c25
alternative constructors
salamonpavel Dec 5, 2023
6f0845e
licences added
salamonpavel Dec 5, 2023
991b446
allow for other types for doobiepgengine
salamonpavel Dec 5, 2023
8bd682e
scaladocs update with respect to generic type of doobiedbengine
salamonpavel Dec 5, 2023
25c42ec
fix formatting
salamonpavel Dec 5, 2023
1b789bb
fix slick part and added cats effect dependency
salamonpavel Dec 5, 2023
a95d958
minors
salamonpavel Dec 5, 2023
f49645c
relax monad requirement from dobiepgengine
salamonpavel Dec 5, 2023
b76801b
minors
salamonpavel Dec 5, 2023
d75b13a
tmp commit
salamonpavel Dec 7, 2023
a3784d7
tmp commit
salamonpavel Dec 7, 2023
bcd8d75
first working version
salamonpavel Dec 7, 2023
3a1f740
working version with status handling available to be defined by clien…
salamonpavel Dec 8, 2023
bd2a21f
StandardQueryStatusHandlingTest
salamonpavel Dec 8, 2023
45e483e
Slick tests refactoring
salamonpavel Dec 8, 2023
6684599
exceptions with docs
salamonpavel Dec 8, 2023
320073e
docs for the supporting classes
salamonpavel Dec 8, 2023
62f62b7
docs for dbfunction and query
salamonpavel Dec 8, 2023
88fce85
docs doobie module
salamonpavel Dec 8, 2023
299dde5
reduce the amount of docs in dbfunction
salamonpavel Dec 8, 2023
0c58a68
minors
salamonpavel Dec 8, 2023
84e30ef
minors
salamonpavel Dec 8, 2023
5f95411
slick function docs
salamonpavel Dec 8, 2023
6cd018d
selectEntry available for both Doobie and Slick modules
salamonpavel Dec 8, 2023
e4a16f7
package renamed, new test for all dates and times common in java, pac…
salamonpavel Dec 9, 2023
742ab50
write times and dates test
salamonpavel Dec 9, 2023
80a72d4
test of unsuccessfull functions with status
salamonpavel Dec 10, 2023
af15e7f
other types reading test
salamonpavel Dec 10, 2023
6711e88
clean-up
salamonpavel Dec 11, 2023
43b60c4
scala 2.13 support
salamonpavel Dec 11, 2023
414cfa0
added missing licenses
salamonpavel Dec 11, 2023
f5db217
github action for 2.13
salamonpavel Dec 11, 2023
03a4a58
clean-up
salamonpavel Dec 11, 2023
852bf6d
doobie module part of coverage reporting
salamonpavel Dec 11, 2023
7695b29
ExplicitNamingRequiredTest
salamonpavel Dec 11, 2023
2799189
DBFunctionFabricTest
salamonpavel Dec 11, 2023
9a2eeea
pr comments addressed
salamonpavel Dec 19, 2023
e3c6e7f
asisnaming test
salamonpavel Dec 19, 2023
b8a4338
downgrade to 1.0.0-RC2 as that's last version with compatible hikari
salamonpavel Dec 20, 2023
94d0212
package object removed - obsolete, meta instances test
salamonpavel Dec 21, 2023
f647caa
docs how to set up things in zio app
salamonpavel Dec 21, 2023
cdb6feb
docs how to set up things in zio app
salamonpavel Dec 21, 2023
712ac82
2.13.11 -> 2.13.12
salamonpavel Dec 22, 2023
6efd571
doc strings refactored
salamonpavel Dec 22, 2023
a8a6860
streaming functions for doobie and slick with tests
salamonpavel Dec 22, 2023
e3bf15a
streaming functions for doobie and slick with tests
salamonpavel Dec 22, 2023
50d7a3a
refactoring of dbfunction
salamonpavel Dec 23, 2023
b542bfc
add licences
salamonpavel Dec 23, 2023
e4e8edc
add licences
salamonpavel Dec 23, 2023
2cbc4f7
scala.language.higherKinds
salamonpavel Dec 23, 2023
bf49ae9
clean up docs
salamonpavel Dec 23, 2023
5d57f4a
fix compilation for scala 2.12
salamonpavel Dec 23, 2023
32e9bf8
fix docs strings
salamonpavel Dec 24, 2023
780a2bd
Added alternative apply to DBStreamingFunction that allows for explic…
salamonpavel Dec 27, 2023
8144e89
Added license headers.
salamonpavel Dec 27, 2023
bc729ea
Change package name
salamonpavel Dec 27, 2023
3fbd923
Merge branch 'feature/doobie-with-status' into feature/doobie-with-st…
salamonpavel Dec 27, 2023
4470c43
Change package name
salamonpavel Dec 27, 2023
7fdf6e4
Change package name
salamonpavel Dec 27, 2023
e8a5607
added Doobie into readme files
salamonpavel Jan 3, 2024
921f0e6
Merge branch 'feature/doobie-with-status' into feature/doobie-with-st…
salamonpavel Jan 3, 2024
0268e9a
merged with parent branch, updated docs
salamonpavel Jan 3, 2024
0a58735
DBFunction made public
salamonpavel Jan 3, 2024
627a554
Merge branch 'master' into feature/doobie-with-status-streaming
salamonpavel Jan 3, 2024
ad36f5f
streaming and slick-streaming modules
salamonpavel Jan 3, 2024
5e45619
jacoco for new modules
salamonpavel Jan 3, 2024
cb1fe0e
minors
salamonpavel Jan 3, 2024
fb92e83
backtics in docs replaced by square brackets in core module
salamonpavel Jan 4, 2024
64dbe90
backtics in docs replaced by square brackets in core module
salamonpavel Jan 4, 2024
05abfd4
docs fix
salamonpavel Jan 4, 2024
6b76004
doobieengine docs fix
salamonpavel Jan 4, 2024
8c7a17a
doobieengine docs fix
salamonpavel Jan 4, 2024
57ec737
doobieengine docs fix
salamonpavel Jan 4, 2024
d14b7d4
doobiequery docs fix
salamonpavel Jan 4, 2024
228177c
doobiefunction, doobiequery docs fix
salamonpavel Jan 4, 2024
2d1fc37
doobiefunction, doobiequery docs fix
salamonpavel Jan 4, 2024
db1d6e5
DoobieStreamingEngine docs fix
salamonpavel Jan 4, 2024
7ce5288
docs fix in slick module
salamonpavel Jan 4, 2024
c70ff3b
docs fix fs2 reference
salamonpavel Jan 4, 2024
c000455
readme update
salamonpavel Jan 4, 2024
2fd7487
alignment
salamonpavel Jan 4, 2024
a70daee
buid.sbt update
salamonpavel Jan 4, 2024
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
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ jobs:
with:
path: |
${{ github.workspace }}/core/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/examples/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/slick/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/slick-streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/doobie/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
key: ${{ runner.os }}-${{ matrix.scalaShort }}-${{ hashFiles('**/jacoco.xml') }}

Expand All @@ -79,8 +81,10 @@ jobs:
with:
path: |
${{ github.workspace }}/core/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/examples/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/slick/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/slick-streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/doobie/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
key: ${{ runner.os }}-${{ matrix.scalaShort }}-${{ hashFiles('**/jacoco.xml') }}
- name: Setup Scala
Expand All @@ -93,7 +97,9 @@ jobs:
with:
paths: >
${{ github.workspace }}/core/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml,
${{ github.workspace }}/streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml,
${{ github.workspace }}/slick/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${{ github.workspace }}/slick/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/slick/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml,

${{ github.workspace }}/slick-streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${{ github.workspace }}/slick-streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
${{ github.workspace }}/slick-streaming/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml,

${{ github.workspace }}/doobie/target/scala-${{ matrix.scalaShort }}/jacoco/report/jacoco.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not agree with removing the code coverage fail-check logic - see the comment on the end of the file.
As I know there is no hard merge block enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miroslavpojer I am not satisfied with this situation either. Unfortunately I couldn't perform merge of previous pull request with this check in place. Let's work together to find a good solution so we can perform tests against a database both locally and within a Github pipeline; for instance with a dockerized Postgres instance.

# examples don't need code coverage - at least not now
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ___
- [Usage](#usage)
- [Concepts](#concepts)
- [Slick module](#slick-module)
- [Slick streaming module](#slick-streaming-module)
- [Doobie module](#doobie-module)
- [Testing](#testing)
- [How to Release](#how-to-release)
<!-- tocstop -->
Expand Down Expand Up @@ -54,10 +56,12 @@ Currently, the library is developed with Postgres as the target DB. But the appr

#### Sbt

Import one of the two available module at the moment. Slick module works with Scala Futures. Doobie module works with any effect type (typically IO or ZIO) provided cats effect's Async instance is available.
Slick module works with Scala Futures. Slick-streaming provides also streaming support for Slick with fs2 streams and any effect type provided cats effect's Async instance is available.
Doobie module provides both non-streaming and streaming functions and works with any effect type (typically IO or ZIO) provided cats effect's Async instance is available.

```scala
libraryDependencies *= "za.co.absa.fa-db" %% "slick" % "X.Y.Z"
libraryDependencies *= "za.co.absa.fa-db" %% "slick-streaming" % "X.Y.Z"
libraryDependencies *= "za.co.absa.fa-db" %% "doobie" % "X.Y.Z"
```

Expand All @@ -67,7 +71,9 @@ libraryDependencies *= "za.co.absa.fa-db" %% "doobie" % "X.Y.Z"

Modules:
* Core [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/core_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/core_2.12)
* Streaming [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/streaming_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/streaming_2.12)
* Slick [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick_2.12)
* Slick-streaming [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick-streaming_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick-streaming_2.12)
* Doobie [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/doobie_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/doobie_2.12)

```xml
Expand All @@ -76,6 +82,11 @@ Modules:
<artifactId>slick_2.12</artifactId>
<version>${latest_version}</version>
</dependency>
<dependency>
<groupId>za.co.absa.fa-db</groupId>
<artifactId>slick-streaming_2.12</artifactId>
<version>${latest_version}</version>
</dependency>
<dependency>
<groupId>za.co.absa.fa-db</groupId>
<artifactId>doobie_2.12</artifactId>
Expand All @@ -86,7 +97,9 @@ Modules:
### Scala 2.13
Modules:
* Core [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/core_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/core_2.13)
* Streaming [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/streaming_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/streaming_2.13)
* Slick [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick_2.13)
* Slick-streaming [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick-streaming_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/slick-streaming_2.13)
* Doobie [![Maven Central](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/doobie_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/za.co.absa.fa-db/doobie_2.13)

```xml
Expand All @@ -95,6 +108,11 @@ Modules:
<artifactId>slick_2.13</artifactId>
<version>${latest_version}</version>
</dependency>
<dependency>
<groupId>za.co.absa.fa-db</groupId>
<artifactId>slick-streaming_2.13</artifactId>
<version>${latest_version}</version>
</dependency>
<dependency>
<groupId>za.co.absa.fa-db</groupId>
<artifactId>doobie_2.13</artifactId>
Expand Down Expand Up @@ -141,18 +159,27 @@ val hStore: Option[Map[String, String]] = pr.nextHStoreOption
val macAddr: Option[MacAddrString] = pr.nextMacAddrOption
```

## Slick streaming module

It additionally brings:

* `class SlickPgStreamingEngine` - implementation of _Streaming_'s `DBStreamingEngine` executing the queries via Slick in a streaming fashion
* `class SlickStreamingResultFunction` - abstract class for DB functions returning sequence of results (fs2.Stream) in a streaming fashion

## Doobie module

As the name suggests it runs on [Doobie library](https://tpolecat.github.io/doobie/). The main benefit of the module is that it allows to use any effect type (typically IO or ZIO) therefore is more suitable for functional programming. It also brings in the [Doobie-Postgres library](https://tpolecat.github.io/doobie/docs/14-PostgreSQL.html) for extended Postgres type support.

It brings:

* `class DoobieEngine` - implementation of _Core_'s `DBEngine` executing the queries via Doobie. The class is type parameterized with the effect type.
* `class DoobieStreamingEngine` - implementation of _Streamings_'s `DBStreamingEngine` executing the queries via Doobie in a streaming fashion. The class is type parameterized with the effect type.
* `class DoobieSingleResultFunction` - abstract class for DB functions returning single result
* `class DoobieMultipleResultFunction` - abstract class for DB functions returning sequence of results
* `class DoobieOptionalResultFunction` - abstract class for DB functions returning optional result
* `class DoobieSingleResultFunctionWithStatus` - abstract class for DB functions with status handling; it requires an implementation of `StatusHandling` to be mixed-in (`StandardStatusHandling` available out-of-the-box)

* `class DoobieStreamingResultFunction` - abstract class for DB functions returning sequence of results (fs2.Stream) in a streaming fashion
*
Since Doobie also interoperates with ZIO, there is an example of how a database connection can be properly established within a ZIO application. Please see [this file](doobie/zio-setup.md) for more details.

## Testing
Expand Down
38 changes: 34 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ lazy val commonJacocoExcludes: Seq[String] = Seq(
)

lazy val parent = (project in file("."))
.aggregate(faDbCore, faDBSlick, faDBDoobie, faDBExamples)
.aggregate(faDbCore, faDBStreaming, faDBSlick, faDBSlickStreaming, faDBDoobie, faDBExamples)
.settings(
name := "root",
libraryDependencies ++= rootDependencies(scalaVersion.value),
Expand All @@ -73,21 +73,51 @@ lazy val faDbCore = (project in file("core"))
jacocoExcludes := commonJacocoExcludes
)

lazy val faDBStreaming = (project in file("streaming"))
.configs(IntegrationTest)
.settings(
name := "streaming",
libraryDependencies ++= streamingDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value,
Defaults.itSettings,
).dependsOn(faDbCore)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:streaming Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)

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

lazy val faDBSlickStreaming = (project in file("slick-streaming"))
.configs(IntegrationTest)
.settings(
name := "slick-streaming",
libraryDependencies ++= slickStreamingDependencies(scalaVersion.value),
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value,
Defaults.itSettings,
).dependsOn(faDbCore, faDBStreaming, faDBSlick)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:slick-streaming Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
)

lazy val faDBDoobie = (project in file("doobie"))
.configs(IntegrationTest)
.settings(
Expand All @@ -96,7 +126,7 @@ lazy val faDBDoobie = (project in file("doobie"))
javacOptions ++= commonJavacOptions,
scalacOptions ++= commonScalacOptions,
Defaults.itSettings,
).dependsOn(faDbCore)
).dependsOn(faDbCore, faDBStreaming)
.settings(
jacocoReportSettings := commonJacocoReportSettings.withTitle(s"fa-db:doobie Jacoco Report - scala:${scalaVersion.value}"),
jacocoExcludes := commonJacocoExcludes
Expand All @@ -108,7 +138,7 @@ lazy val faDBExamples = (project in file("examples"))
name := "examples",
libraryDependencies ++= examplesDependencies(scalaVersion.value),
Test / parallelExecution := false,
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value,
publish / skip := true
).dependsOn(faDbCore, faDBSlick)
.settings(
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/za/co/absa/fadb/DBEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import za.co.absa.fadb.exceptions.StatusException
import scala.language.higherKinds

/**
* `DBEngine` is an abstract class that represents a database engine.
* [[DBEngine]] is an abstract class that represents a database engine.
* It provides methods to execute queries and fetch results from a database.
* @tparam F - The type of the context in which the database queries are executed.
*/
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/za/co/absa/fadb/DBFunction.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import za.co.absa.fadb.status.handling.StatusHandling
import scala.language.higherKinds

/**
* `DBFunction` is an abstract class that represents a database function.
* [[DBFunction]] is an abstract class that represents a database function.
* @param functionNameOverride - Optional parameter to override the class name if it does not match the database function name.
* @param schema - The schema the function belongs to.
* @param dBEngine - The database engine that is supposed to execute the function (contains connection to the database).
Expand Down Expand Up @@ -73,7 +73,7 @@ abstract class DBFunction[I, R, E <: DBEngine[F], F[_]](functionNameOverride: Op
}

/**
* `DBFunctionWithStatus` is an abstract class that represents a database function with a status.
* [[DBFunctionWithStatus]] is an abstract class that represents a database function with a status.
* It extends the [[DBFunction]] class and adds handling for the status of the function invocation.
* @param functionNameOverride - Optional parameter to override the class name if it does not match the database function name.
* @param schema - The schema the function belongs to.
Expand All @@ -100,7 +100,7 @@ abstract class DBFunctionWithStatus[I, R, E <: DBEngine[F], F[_]](functionNameOv

/**
* Executes the database function and returns multiple results.
* @param values
* @param values the values to pass over to the database function.
* @return A sequence of results from the database function.
*/
def apply(values: I): F[Either[StatusException, R]] = dBEngine.runWithStatus(query(values))
Expand Down Expand Up @@ -131,7 +131,7 @@ abstract class DBFunctionWithStatus[I, R, E <: DBEngine[F], F[_]](functionNameOv
object DBFunction {

/**
* `DBMultipleResultFunction` is an abstract class that represents a database function returning multiple results.
* [[DBMultipleResultFunction]] is an abstract class that represents a database function returning multiple results.
* It extends the [[DBFunction]] class and overrides the apply method to return a sequence of results.
*/
abstract class DBMultipleResultFunction[I, R, E <: DBEngine[F], F[_]](
Expand All @@ -155,7 +155,7 @@ object DBFunction {
}

/**
* `DBSingleResultFunction` is an abstract class that represents a database function returning a single result.
* [[DBSingleResultFunction]] is an abstract class that represents a database function returning a single result.
* It extends the [[DBFunction]] class and overrides the apply method to return a single result.
*/
abstract class DBSingleResultFunction[I, R, E <: DBEngine[F], F[_]](
Expand All @@ -178,7 +178,7 @@ object DBFunction {
}

/**
* `DBOptionalResultFunction` is an abstract class that represents a database function returning an optional result.
* [[DBOptionalResultFunction]] is an abstract class that represents a database function returning an optional result.
* It extends the [[DBFunction]] class and overrides the apply method to return an optional result.
*/
abstract class DBOptionalResultFunction[I, R, E <: DBEngine[F], F[_]](
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/za/co/absa/fadb/DBSchema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import za.co.absa.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.fadb.naming.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.fadb.naming.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 @@ -19,15 +19,15 @@ package za.co.absa.fadb.naming
import za.co.absa.fadb.exceptions.NamingException

/**
* `ExplicitNamingRequired` is a `NamingConvention` that throws a `NamingConvention` for any string.
* [[ExplicitNamingRequired]] is a [[NamingConvention]] that throws a [[za.co.absa.fadb.exceptions.NamingException]] for any string.
* This is used when explicit naming is required and no other naming convention should be applied.
*/
class ExplicitNamingRequired extends NamingConvention {

/**
* Throws a `NamingConvention` with a message indicating that explicit naming is required.
* Throws a [[za.co.absa.fadb.exceptions.NamingException]] with a message indicating that explicit naming is required.
* @param original - The original string.
* @return Nothing, as a `NamingException` is always thrown.
* @return Nothing, as a [[za.co.absa.fadb.exceptions.NamingException]] is always thrown.
*/
override def stringPerConvention(original: String): String = {
val message = s"No convention for '$original', explicit naming required."
Expand All @@ -36,14 +36,14 @@ class ExplicitNamingRequired extends NamingConvention {
}

/**
* `ExplicitNamingRequired.Implicits` provides an implicit `NamingConvention` instance that
* throws a `NamingException` for any string.
* [[ExplicitNamingRequired.Implicits]] provides an implicit [[NamingConvention]] instance that
* throws a [[za.co.absa.fadb.exceptions.NamingException]] for any string.
*/
object ExplicitNamingRequired {
object Implicits {

/**
* An implicit `NamingConvention` instance that throws a `NamingException` for any string.
* An implicit [[NamingConvention]] instance that throws a [[za.co.absa.fadb.exceptions.NamingException]] for any string.
*/
implicit val namingConvention: NamingConvention = new ExplicitNamingRequired()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package za.co.absa.fadb.naming

/**
* `LettersCase` is a sealed trait that represents different cases of letters.
* [[LettersCase]] is a sealed trait that represents different cases of letters.
* It provides a method to convert a string to the specific case.
*/
sealed trait LettersCase {
Expand All @@ -33,21 +33,21 @@ sealed trait LettersCase {
object LettersCase {

/**
* `AsIs` is a [[LettersCase]] that leaves strings as they are.
* [[AsIs]] is a [[LettersCase]] that leaves strings as they are.
*/
case object AsIs extends LettersCase {
override def convert(s: String): String = s
}

/**
* `LowerCase` is a [[LettersCase]] that converts strings to lower case.
* [[LowerCase]] is a [[LettersCase]] that converts strings to lower case.
*/
case object LowerCase extends LettersCase {
override def convert(s: String): String = s.toLowerCase
}

/**
* `UpperCase` is a [[LettersCase]] that converts strings to upper case.
* [[UpperCase]] is a [[LettersCase]] that converts strings to upper case.
*/
case object UpperCase extends LettersCase {
override def convert(s: String): String = s.toUpperCase
Expand Down
Loading
Loading