ignore unmapped values
When a name is not mapped then the field should not be updated. This is a bit weird and maybe should throw an error, but at least we avoid chaning columns that are not meant to be changed.
This commit is contained in:
parent
f28b0d0ae3
commit
1696b6e15e
@ -80,6 +80,9 @@ func FieldMapToUpdate(fm types.FieldMap, nameMap map[string]string) (string, []i
|
||||
i := 0
|
||||
for key, val := range fm.Fields() {
|
||||
if name, found := nameMap[key]; found {
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
i++
|
||||
setClause = append(setClause, fmt.Sprintf("%s = $%d", name, i))
|
||||
if val == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user