Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlauvlwj committed Jul 1, 2024
1 parent 733494a commit 59583df
Showing 1 changed file with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,31 @@ internal val Database.Companion.global: Database get() {
* on conflict (id) do update set salary = salary + ?
* ```
*
* By default, the column used in the `on conflict` statement is the primary key you already defined in
* the schema definition. If you want, you can specify one or more columns for the `on conflict` statement
* as belows:
*
* ```kotlin
* Employees.insertOrUpdate {
* set(it.id, 1)
* set(it.name, "vince")
* set(it.job, "engineer")
* set(it.salary, 1000)
* set(it.hireDate, LocalDate.now())
* set(it.departmentId, 1)
* onConflict(it.name, it.job) {
* set(it.salary, it.salary + 900)
* }
* }
* ```
*
* Generated SQL:
*
* ```sql
* insert into t_employee (id, name, job, salary, hire_date, department_id) values (?, ?, ?, ?, ?, ?)
* on conflict (name, job) do update set salary = salary + ?
* ```
*
* @param block the DSL block used to construct the expression.
* @return the effected row count.
*/
Expand Down Expand Up @@ -157,6 +182,42 @@ public fun <T : BaseTable<*>> T.bulkInsert(block: BulkInsertStatementBuilder<T>.
* on conflict (id) do update set salary = salary + ?
* ```
*
* By default, the column used in the `on conflict` statement is the primary key you already defined in
* the schema definition. If you want, you can specify one or more columns for the `on conflict` statement
* as belows:
*
* ```kotlin
* Employees.bulkInsertOrUpdate {
* item {
* set(it.id, 1)
* set(it.name, "vince")
* set(it.job, "engineer")
* set(it.salary, 1000)
* set(it.hireDate, LocalDate.now())
* set(it.departmentId, 1)
* }
* item {
* set(it.id, 5)
* set(it.name, "vince")
* set(it.job, "engineer")
* set(it.salary, 1000)
* set(it.hireDate, LocalDate.now())
* set(it.departmentId, 1)
* }
* onConflict(it.name, it.job) {
* set(it.salary, it.salary + 900)
* }
* }
* ```
*
* Generated SQL:
*
* ```sql
* insert into t_employee (id, name, job, salary, hire_date, department_id)
* values (?, ?, ?, ?, ?, ?), (?, ?, ?, ?, ?, ?)
* on conflict (name, job) do update set salary = salary + ?
* ```
*
* @since 3.3.0
* @param block the DSL block used to construct the expression.
* @return the effected row count.
Expand Down

0 comments on commit 59583df

Please sign in to comment.