Why SELECT
after UPDATE
?
#2599
Answered
by
a8m
frederikhors
asked this question in
Q&A
-
Using this code: err := ent.WithTx(ctx, entClient, func(tx *generated.Tx) error {
// other ops...
entPlayer, err := tx.Player.UpdateOneID(id).SetName(newName).Save(ctx)
// handle err
// use entPlayer here...
return nil
})
// handle err I expect to have only the Instead I get
Why? I tried with |
Beta Was this translation helpful? Give feedback.
Answered by
a8m
Jun 4, 2022
Replies: 1 comment 10 replies
-
The |
Beta Was this translation helpful? Give feedback.
10 replies
Answer selected by
frederikhors
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
Exec
option usesSave
under the hood and load the record - the same layer used by hooks/privacy ofUpdateOne
operation. If you don't want to load the record, useUpdate().Where(player.ID(id))....Exec(ctx)
instead.