Skip to content

Commit

Permalink
Merge pull request #342 from takapi327/refactor/2024-12-Fixed-onDupli…
Browse files Browse the repository at this point in the history
…cateKeyUpdate-parameter

Refactor/2024 12 fixed on duplicate key update parameter
  • Loading branch information
takapi327 authored Dec 23, 2024
2 parents 7e5ea57 + 25d1b0d commit 2067508
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sealed trait Insert[A] extends Command:
* .onDuplicateKeyUpdate(_.name)
* }}}
*/
def onDuplicateKeyUpdate[C](columns: A => Column[C]): Insert.DuplicateKeyUpdate[A]
def onDuplicateKeyUpdate[B](columns: A => Column[B]): Insert.DuplicateKeyUpdate[A]

/**
* Methods for constructing INSERT ... ON DUPLICATE KEY UPDATE statements.
Expand All @@ -46,12 +46,12 @@ sealed trait Insert[A] extends Command:

object Insert:

case class Impl[A, B](table: A, statement: String, params: List[Parameter.Dynamic]) extends Insert[A]:
case class Impl[A](table: A, statement: String, params: List[Parameter.Dynamic]) extends Insert[A]:

@targetName("combine")
override def ++(sql: SQL): SQL = this.copy(statement = statement ++ sql.statement, params = params ++ sql.params)

override def onDuplicateKeyUpdate[C](columns: A => Column[C]): Insert.DuplicateKeyUpdate[A] =
override def onDuplicateKeyUpdate[B](columns: A => Column[B]): Insert.DuplicateKeyUpdate[A] =
Insert.DuplicateKeyUpdate(
table,
s"$statement ON DUPLICATE KEY UPDATE ${ columns(table).duplicateKeyUpdateStatement }",
Expand Down

0 comments on commit 2067508

Please sign in to comment.