Skip to content

Commit

Permalink
fix: prepareDeleteQuery will find query args in changeset.OldValues
Browse files Browse the repository at this point in the history
Resolves:
could not find name id in map[string]interface {}
  • Loading branch information
13rac1 committed Apr 18, 2020
1 parent 9e989ac commit f570d62
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/axon/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func prepareUpdateQuery(schema string, primaryKey []string, change *warppipe.Cha
}

func prepareDeleteQuery(schema string, primaryKey []string, change *warppipe.Changeset) (string, map[string]interface{}) {
_, _, values, err := prepareQueryArgs(change.NewValues)
_, _, values, err := prepareQueryArgs(change.OldValues)
if err != nil {
log.Fatalf("prepareQueryArgs: error in changeset %s: %s", change, err)
}
Expand Down Expand Up @@ -158,6 +158,7 @@ func updateRow(conn *sqlx.DB, schema string, change *warppipe.Changeset, primary
log.Print("update duplicate row skipped")
return nil
}

return fmt.Errorf("PG error %s:%s failed to update %s for query %s: %+v", pqe.Code, pqe.Code.Name(), change, removeDuplicateSpaces(query), err)
}
log.Printf("row updated: %s", change)
Expand Down

0 comments on commit f570d62

Please sign in to comment.