method

Fields.Edit

Edit applies checked changes to a detached draft and returns a new field list. Use it to refine a reusable graph without rebuilding it. The result is published only when the callback and graph validation succeed; on error, Edit returns an unchanged snapshot of the original fields.

Arguments

ArgumentTypeDescription
editfunc(*ChildrenDraft) errorThe edit value.

Returns

The declared result.

(Fields, error)

Full signature

func (fields Fields) Edit(edit func(*ChildrenDraft) error) (Fields, error)

Source field/graph_edit.go:272

Related types

  • Fields

    Fields is the ordered list assigned to ridu.Collection.Fields, ridu.Global.Fields, or a nested field constructor. Populate it with Nodes from this package's constructors. Ridu snapshots the caller-owned slice during construction, editing, and config resolution.

  • ChildrenDraft

    ChildrenDraft owns a detached slice. Committing snapshots again, so retained drafts cannot mutate published graphs. Structural edits are explicit.