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
| Argument | Type | Description |
|---|---|---|
parent | Parent | The parent value. |
name | string | The name value. |
as | func(Node) (Child, | The as value. |
edit | func(Child) Child | The 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)Related types
NodeNode 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.
ChildrenDraftChildrenDraft owns a detached slice. Committing snapshots again, so retained drafts cannot mutate published graphs. Structural edits are explicit.