MCPcopy
hub / github.com/ent/ent / UpdateNode

Function UpdateNode

dialect/sql/sqlgraph/graph.go:842–853  ·  view source on GitHub ↗

UpdateNode applies the UpdateSpec on one node in the graph.

(ctx context.Context, drv dialect.Driver, spec *UpdateSpec)

Source from the content-addressed store, hash-verified

840
841// UpdateNode applies the UpdateSpec on one node in the graph.
842func UpdateNode(ctx context.Context, drv dialect.Driver, spec *UpdateSpec) error {
843 tx, err := drv.Tx(ctx)
844 if err != nil {
845 return err
846 }
847 gr := graph{tx: tx, builder: sql.Dialect(drv.Dialect())}
848 cr := &updater{UpdateSpec: spec, graph: gr}
849 if err := cr.node(ctx, tx); err != nil {
850 return rollback(tx, err)
851 }
852 return tx.Commit()
853}
854
855// UpdateNodes applies the UpdateSpec on a set of nodes in the graph.
856func UpdateNodes(ctx context.Context, drv dialect.Driver, spec *UpdateSpec) (int, error) {

Callers 15

sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92
sqlSaveMethod · 0.92

Calls 6

nodeMethod · 0.95
DialectFunction · 0.92
rollbackFunction · 0.70
TxMethod · 0.65
DialectMethod · 0.65
CommitMethod · 0.65

Tested by 2

TestUpdateNodeFunction · 0.68
TestExecUpdateNodeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…