Skip to content

Commit

Permalink
ent: document ent.Value returned by mutations (ent#3556)
Browse files Browse the repository at this point in the history
Fixed ent#3471
  • Loading branch information
a8m authored May 23, 2023
1 parent 0aaaad6 commit d7b3a6c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ent.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (Schema) Policy() Policy { return nil }
func (Schema) Annotations() []schema.Annotation { return nil }

type (
// Value represents a value returned by ent.
// Value represents a dynamic value returned by mutations or queries.
Value any

// Mutation represents an operation that mutate the graph.
Expand Down Expand Up @@ -328,7 +328,14 @@ type (

// Mutator is the interface that wraps the Mutate method.
Mutator interface {
// Mutate apply the given mutation on the graph.
// Mutate apply the given mutation on the graph. The returned
// ent.Value is changing according to the mutation operation:
//
// OpCreate, the returned value is the created node (T).
// OpUpdateOne, the returned value is the updated node (T).
// OpUpdate, the returned value is the amount of updated nodes (int).
// OpDeleteOne, OpDelete, the returned value is the amount of deleted nodes (int).
//
Mutate(context.Context, Mutation) (Value, error)
}

Expand Down

0 comments on commit d7b3a6c

Please sign in to comment.