Skip to content

Commit 179f27d

Browse files
fix compile error
1 parent a15b928 commit 179f27d

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

ktorm-support-postgresql/src/main/kotlin/org/ktorm/support/postgresql/Global.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public fun <T : BaseTable<*>> T.insertOrUpdate(block: InsertOrUpdateStatementBui
110110
* @return the effected row count.
111111
* @see batchInsert
112112
*/
113-
public fun <T : BaseTable<*>> T.bulkInsert(block: BulkInsertStatementBuilder<T>.() -> Unit): Int {
113+
public fun <T : BaseTable<*>> T.bulkInsert(block: BulkInsertStatementBuilder<T>.(T) -> Unit): Int {
114114
return Database.global.bulkInsert(this, block)
115115
}
116116

@@ -157,6 +157,6 @@ public fun <T : BaseTable<*>> T.bulkInsert(block: BulkInsertStatementBuilder<T>.
157157
* @return the effected row count.
158158
* @see bulkInsert
159159
*/
160-
public fun <T : BaseTable<*>> T.bulkInsertOrUpdate(block: BulkInsertOrUpdateStatementBuilder<T>.() -> Unit): Int {
160+
public fun <T : BaseTable<*>> T.bulkInsertOrUpdate(block: BulkInsertOrUpdateStatementBuilder<T>.(T) -> Unit): Int {
161161
return Database.global.bulkInsertOrUpdate(this, block)
162162
}

ktorm-support-postgresql/src/main/kotlin/org/ktorm/support/postgresql/PostgreSqlDialect.kt

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,11 @@ public open class PostgreSqlFormatter(
153153
writeKeyword("values ")
154154
writeValues(expr.assignments)
155155

156-
if (expr.conflictColumns.isNotEmpty()) {
156+
if (expr.updateAssignments.isNotEmpty()) {
157157
writeKeyword("on conflict ")
158158
writeColumnNames(expr.conflictColumns)
159-
160-
if (expr.updateAssignments.isNotEmpty()) {
161-
writeKeyword("do update set ")
162-
visitColumnAssignments(expr.updateAssignments)
163-
} else {
164-
writeKeyword("do nothing ")
165-
}
159+
writeKeyword("do update set ")
160+
visitColumnAssignments(expr.updateAssignments)
166161
}
167162

168163
return expr
@@ -182,16 +177,11 @@ public open class PostgreSqlFormatter(
182177
writeValues(assignments)
183178
}
184179

185-
if (expr.conflictColumns.isNotEmpty()) {
180+
if (expr.updateAssignments.isNotEmpty()) {
186181
writeKeyword("on conflict ")
187182
writeColumnNames(expr.conflictColumns)
188-
189-
if (expr.updateAssignments.isNotEmpty()) {
190-
writeKeyword("do update set ")
191-
visitColumnAssignments(expr.updateAssignments)
192-
} else {
193-
writeKeyword("do nothing ")
194-
}
183+
writeKeyword("do update set ")
184+
visitColumnAssignments(expr.updateAssignments)
195185
}
196186

197187
return expr

0 commit comments

Comments
 (0)