Skip to content

Commit

Permalink
Spec Refactor (#73)
Browse files Browse the repository at this point in the history
* Spec Refactor:

* Spec.build method is removed. Specs are now fully declarative and the DbType is responsible for implementation.
* Add Spec.prefix method
* Change Spec.seek nullOrder, Spec.orderBy direction and nullOrder to be database Default
* Tests are improved and now shared between database specs insteads of duplicated. The increased coverage exposed some tangential issues which are also resolved in this MR (see below). Note: switched from munit assertEquals -> assert until fix for scalameta/munit#855 (comment) is released.

Additional changes:

* No longer need to handle null when using DbCodec.biMap, or implementing DbCodec.readSingle
* When implementing DbCodec, new method readSingleOption must be defined
* Support optional products in outer-join queries (see test OptionalProductTests)
* Switched to latest scalafmt version to prevent OOM in OracleTests
* Make Frag, Query, Update, Returning into regular classes
* Frag.returningKeys method which uses ResultSet.getGeneratedKeys
* Make MySq insertReturning throw, since we shouldn't define 2-query repository methods.

* reduce duplication with shared DbCodec.readSingleOpt impl

* remove unused def in MySqlDbType

* fix SqlLogger error formatting

* use keyColumsArr in Returning

* make sure no expr duplication in sql macro

* add test to ensure that embedded frag param exprs are evaluated only once
  • Loading branch information
AugustNagro authored Dec 1, 2024
1 parent 7555a22 commit a2334fd
Show file tree
Hide file tree
Showing 74 changed files with 2,254 additions and 3,270 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.3
version = 3.8.4-RC3
runner.dialect = scala3
rewrite.scala3.insertEndMarkerMinLines = 20
rewrite.scala3.removeEndMarkerMaxLines = 19
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ThisBuild / publishTo := {
}
ThisBuild / publish / skip := true

Global / onChangedBuildSource := ReloadOnSourceChanges
addCommandAlias("fmt", "scalafmtAll")

val testcontainersVersion = "0.41.4"
val circeVersion = "0.14.10"
Expand Down
Loading

0 comments on commit a2334fd

Please sign in to comment.