Skip to content

Commit

Permalink
Merge branch 'master' into update/tapir-json-zio-1.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii authored Mar 14, 2024
2 parents a6714ef + 9a8775e commit 8d44dff
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/[email protected]
- name: Setup Java and Scala
uses: actions/setup-java@v3.13.0
uses: actions/setup-java@v4.0.0
with:
distribution: temurin
java-version: '17'
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/[email protected]
- name: Setup Java and Scala
uses: actions/setup-java@v3.13.0
uses: actions/setup-java@v4.0.0
with:
distribution: temurin
java-version: '17'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-20.04
steps:
- uses: release-drafter/release-drafter@v5
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/scala-steward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Scala Steward
steps:
- name: Scala Steward
uses: scala-steward-org/scala-steward-action@v2.61.0
uses: scala-steward-org/scala-steward-action@v2.63.0
with:
github-app-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_ID }}
github-app-installation-id: ${{ secrets.SCALA_STEWARD_GITHUB_APP_INSTALLATION_ID }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class OnConflictJdbcSpec extends OnConflictSpec {
ctx.run(testQuery2) mustEqual res2
ctx.run(testQuery3) mustEqual res3
}
"BATCH INSERT IGNORE" in {
import `onConflictIgnore`._
ctx.run(batchInsert)
ctx.run(testQuery3) mustEqual res3
}

"ON DUPLICATE KEY UPDATE i=i " in {
import `onConflictIgnore(_.i)`._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class OnConflictJdbcSpec extends OnConflictSpec {
ctx.run(testQuery3) mustEqual res3
}

"BATCH ON CONFLICT DO NOTHING" in {
import `onConflictIgnore`._
ctx.run(batchInsert)
ctx.run(testQuery3) mustEqual res3
}

"ON CONFLICT (i) DO NOTHING" in {
import `onConflictIgnore(_.i)`._
ctx.run(testQuery1) mustEqual res1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class OnConflictJdbcSpec extends OnConflictSpec {
ctx.run(testQuery3) mustEqual res3
}

"BATCH ON CONFLICT DO NOTHING" in {
import `onConflictIgnore`._
ctx.run(batchInsert)
ctx.run(testQuery3) mustEqual res3
}

"ON CONFLICT (i) DO NOTHING" in {
import `onConflictIgnore(_.i)`._
ctx.run(testQuery1) mustEqual res1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ private[getquill] enum BatchActionType {
* Otherwise SQLServer will not let you insert the row because `IDENTITY_INSERT` will be off.
*/
object PossiblyInfixAction {
private def isTailAction(actionAst: Ast) =
actionAst.isInstanceOf[ast.Insert] || actionAst.isInstanceOf[ast.Update] || actionAst.isInstanceOf[ast.Delete]
private def isTailAction(actionAst: Ast) = {
actionAst.isInstanceOf[ast.Insert] || actionAst.isInstanceOf[ast.Update] || actionAst.isInstanceOf[ast.Delete] ||
actionAst.isInstanceOf[ast.OnConflict]
}

private def hasOneAction(params: List[Ast]) =
params.filter(isTailAction(_)).length == 1
def unapply(actionAst: ast.Ast): Option[Ast] =
Expand All @@ -104,6 +107,7 @@ private[getquill] object ActionEntity {
case PossiblyInfixAction(ast.Insert(entity, _)) => Some(BatchActionType.Insert)
case PossiblyInfixAction(ast.Update(entity, assignments)) => Some(BatchActionType.Update)
case PossiblyInfixAction(ast.Delete(entity)) => Some(BatchActionType.Delete)
case PossiblyInfixAction(ast.OnConflict(_,_,_)) => Some(BatchActionType.Insert)
case _ => None
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ trait OnConflictSpec extends Spec {
qr1.filter(_.i == 1)
}
val res3 = List(TestEntity("", 1, 0, None, true))

inline def batchInsert = quote {
liftQuery(List(
TestEntity("", 1, 0, None, true),
TestEntity("", 1, 0, None, true),
TestEntity("", 1, 0, None, true),
)).foreach( v => qr1.insertValue(v).onConflictIgnore)
}
}

object `onConflictIgnore(_.i)` {
Expand Down

0 comments on commit 8d44dff

Please sign in to comment.