@@ -50,7 +50,29 @@ import (
5050 "gorm.io/gorm/schema"
5151)
5252
53- // Update callback function for Oracle
53+ // Update overrides GORM's update callback for Oracle.
54+ //
55+ // It builds Oracle-compatible UPDATE statements and supports:
56+ //
57+ // - Standard updates without RETURNING using GORM’s default SQL build, with
58+ // bind variable conversion for Oracle types.
59+ // - Updates with RETURNING, emitting a PL/SQL block that performs
60+ // UPDATE … RETURNING BULK COLLECT INTO for multi-row updates,
61+ // wiring sql.Out binds for each returned column and row.
62+ // - UPDATE safety: checks for missing WHERE conditions and refuses to run
63+ // unless AllowGlobalUpdate is set or the WHERE clause has meaningful
64+ // conditions (beyond soft-delete filters).
65+ // - Primary key WHERE injection when the destination object or slice has
66+ // identifiable PK values, to avoid unintended mass updates.
67+ // - Soft-delete compatibility: conditions on deleted_at are ignored for the
68+ // safety check, but preserved in the WHERE for the actual SQL.
69+ //
70+ // For updates with RETURNING, OUT bind results are mapped back into the
71+ // destination struct or slice using getUpdateReturningValues.
72+ //
73+ // Register with:
74+ //
75+ // db.Callback().Update().Replace("gorm:update", oracle.Update)
5476func Update (db * gorm.DB ) {
5577 if db .Error != nil || db .Statement == nil {
5678 return
0 commit comments