entc/mutation: explain when object is fetched from db (#496)

This commit is contained in:
Ariel Mashraki
2020-05-21 10:10:52 +03:00
committed by GitHub
parent 5ed339839a
commit dbf6bb8006
23 changed files with 539 additions and 181 deletions

View File

@@ -140,7 +140,9 @@ func (m *NodeMutation) Value() (r int, exists bool) {
return *v, true
}
// OldValue returns the old value value, if exists.
// OldValue returns the old value value of the Node.
// If the Node object wasn't provided to the builder, the object is fetched
// from the database.
// An error is returned if the mutation operation is not UpdateOne, or database query fails.
func (m *NodeMutation) OldValue(ctx context.Context) (v int, err error) {
if !m.op.Is(OpUpdateOne) {