Skip to content

Commit 7f01600

Browse files
fix(helper): handle null.String with 'null' value in update extraction
1 parent 5882a97 commit 7f01600

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

go/helper/struct_cache.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,13 @@ func ExtractUpdateValues(tmpl *UpdateTemplateInfo, structVal reflect.Value, anot
317317
continue
318318
}
319319

320-
// Handle "null" string literal
320+
// Handle "null" string literal — both raw string and null.String types
321321
if str, ok := value.(string); ok && str == strNull { //nolint:errcheck
322322
value = null.String{} //nolint:errcheck
323323
}
324+
if ns, ok := value.(null.String); ok && ns.Valid && ns.String == strNull { //nolint:errcheck
325+
value = null.String{} //nolint:errcheck
326+
}
324327

325328
result.Cols = append(result.Cols, fp.ColName+"=?")
326329
result.Values = append(result.Values, value)

0 commit comments

Comments
 (0)