function

AppendChild

AppendChild appends one direct child to a group or array. It snapshots the child and preserves existing parent and child policies. Duplicate or invalid names return the original parent and an error.

Arguments

ArgumentTypeDescription
parentParentThe parent value.
childNodeThe child value.

Returns

The declared result.

(Parent, error)

Full signature

func AppendChild[Parent interface { Node EditChildren(func(*ChildrenDraft) error) (Parent, error) }](parent Parent, child Node) (Parent, error)

Source field/child_edit.go:49

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.