function

EditChild

EditChild refines one direct child of a group or array while retaining the parent's concrete type. Pass a checked converter such as AsText or AsSelect and return the refined field from edit. Existing policies and attachments remain on that field unless the edit explicitly replaces them.

Arguments

ArgumentTypeDescription
parentParentThe parent value.
namestringThe name value.
asfunc(Node) (Child, error)The as value.
editfunc(Child) ChildThe edit value.

Returns

The declared result.

(Parent, error)

Full signature

func EditChild[Parent interface { Node EditChildren(func(*ChildrenDraft) error) (Parent, error) }, Child Node]( parent Parent, name string, as func(Node) (Child, error), edit func(Child) Child, ) (Parent, error)

Source field/child_edit.go:10

Related types

  • Node

    Node is any field definition that can be placed in Fields. Authors normally create nodes with constructors such as Text, Select, Group, or Array and use their concrete fluent methods before adding them to a field list. The interface is sealed so Ridu can snapshot every supported field safely.

  • ChildrenDraft

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