UpdateNode applies the UpdateSpec on one node in the graph.
(ctx context.Context, drv dialect.Driver, spec *UpdateSpec)
| 840 | |
| 841 | // UpdateNode applies the UpdateSpec on one node in the graph. |
| 842 | func 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. |
| 856 | func UpdateNodes(ctx context.Context, drv dialect.Driver, spec *UpdateSpec) (int, error) { |
searching dependent graphs…