Skip to content

Commit

Permalink
fix planner update
Browse files Browse the repository at this point in the history
  • Loading branch information
nasdf committed Apr 20, 2024
1 parent d31f076 commit 1b4c429
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions planner/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@ func (n *updateNode) Next() (bool, error) {

n.currentValue = n.results.Value()

docMap := map[string]any{
request.DocIDFieldName: n.currentValue.GetID(),
}
for k, v := range n.input {
docMap[k] = v
docID, err := client.NewDocIDFromString(n.currentValue.GetID())
if err != nil {
return false, err
}
doc, err := client.NewDocFromMap(docMap, n.collection.Definition())
doc, err := n.collection.Get(n.p.ctx, docID, false)
if err != nil {
return false, err
}
for k, v := range n.input {
if err := doc.Set(k, v); err != nil {
return false, err
}
}
err = n.collection.Update(n.p.ctx, doc)
if err != nil {
return false, err
Expand Down

0 comments on commit 1b4c429

Please sign in to comment.