Documentation ¶
Index ¶
- Constants
- func ExtractNodeDataFromList[T *Node[T]](list []*Node[T]) []T
- func NewUUID() uuid.UUID
- type Marshaller
- type Node
- func (n *Node[T]) AddChild(child *Node[T])
- func (n *Node[T]) ApplyTo(to *Node[T])
- func (n *Node[T]) Children() []*Node[T]
- func (n *Node[T]) ChildrenElemByID()
- func (n *Node[T]) ChildrenElemByIndex()
- func (n *Node[T]) ChildrenElemByName()
- func (n *Node[T]) ChildrenElemByPath()
- func (n *Node[T]) ChildrenElemByType()
- func (n *Node[T]) ChildrenLastElem()
- func (n *Node[T]) ChildrenLen()
- func (n *Node[T]) ChildrenMoveTo()
- func (n *Node[T]) ChildrenRemoveByID()
- func (n *Node[T]) ChildrenRemoveByIndex()
- func (n *Node[T]) ChildrenRemoveByName()
- func (n *Node[T]) ChildrenRemoveByPath()
- func (n *Node[T]) ChildrenReset()
- func (n *Node[T]) ChildrenSum(parent *Node[T]) *Node[T]
- func (n *Node[T]) ChildrenSwap()
- func (n *Node[T]) Clone(newParent *Node[T], preserveID bool) *Node[T]
- func (n *Node[T]) Container() bool
- func (n *Node[T]) CopyFrom(from *Node[T])
- func (n *Node[T]) CreateItem(parent *Node[T], data T) *Node[T]
- func (n *Node[T]) Depth() int
- func (n *Node[T]) Enabled() bool
- func (n *Node[T]) FindByID(id uuid.UUID) *Node[T]
- func (n *Node[T]) FindByIndex(id uuid.UUID) *Node[T]
- func (n *Node[T]) FindByName(id uuid.UUID) *Node[T]
- func (n *Node[T]) FindByPath(id uuid.UUID) *Node[T]
- func (n *Node[T]) FindByType(id uuid.UUID) *Node[T]
- func (n *Node[T]) Format(root *Node[T]) string
- func (n *Node[T]) GetType() string
- func (n *Node[T]) HasChildren() bool
- func (n *Node[T]) InsertByID(id uuid.UUID) *Node[T]
- func (n *Node[T]) InsertByIndex(id uuid.UUID) *Node[T]
- func (n *Node[T]) InsertByName(id uuid.UUID) *Node[T]
- func (n *Node[T]) InsertByPath(id uuid.UUID) *Node[T]
- func (n *Node[T]) InsertByType(id uuid.UUID) *Node[T]
- func (n *Node[T]) InsertItem(parentID uuid.UUID, data T) *Node[T]
- func (n *Node[T]) Marshal(objectPtr any) (Provider[T], error)
- func (n *Node[T]) MarshalBinary() (data []byte, err error)
- func (n *Node[T]) MarshalJSON() ([]byte, error)
- func (n *Node[T]) MarshalText() (text []byte, err error)
- func (n *Node[T]) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (n *Node[T]) Open() bool
- func (n *Node[T]) Parent() *Node[T]
- func (n *Node[T]) RemoveByID(id uuid.UUID)
- func (n *Node[T]) RemoveByIndex(id uuid.UUID)
- func (n *Node[T]) RemoveByName(id uuid.UUID)
- func (n *Node[T]) RemoveByPath(id uuid.UUID)
- func (n *Node[T]) RemoveSelf(id uuid.UUID)
- func (n *Node[T]) SetChildren(children []*Node[T])
- func (n *Node[T]) SetFormatRowCallback(formatRowCallback func(*Node[T]) string)
- func (n *Node[T]) SetHeader(header []string)
- func (n *Node[T]) SetOpen(open bool)
- func (n *Node[T]) SetParent(parent *Node[T])
- func (n *Node[T]) SetType(t string)
- func (n *Node[T]) Sort(cmp func(a, b T) bool)
- func (n *Node[T]) String() string
- func (n *Node[T]) UUID() uuid.UUID
- func (n *Node[T]) Unmarshal(tree Provider[T]) (objectPtr any, err error)
- func (n *Node[T]) UnmarshalBinary(data []byte) error
- func (n *Node[T]) UnmarshalJSON(bytes []byte) error
- func (n *Node[T]) UnmarshalText(text []byte) error
- func (n *Node[T]) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (n *Node[T]) UpdateByID(id uuid.UUID, data T)
- func (n *Node[T]) UpdateByIndex(id uuid.UUID, data T)
- func (n *Node[T]) UpdateByName(id uuid.UUID, data T)
- func (n *Node[T]) UpdateByPath(id uuid.UUID, data T)
- func (n *Node[T]) UpdateByType(id uuid.UUID, data T)
- func (n *Node[T]) Walk(callback func(node *Node[T]))
- func (n *Node[T]) WalkContainer(callback func(node *Node[T]))
- type Provider
- type Unmarshaler
Constants ¶
View Source
const ContainerKeyPostfix = "_container"
Variables ¶
This section is empty.
Functions ¶
func ExtractNodeDataFromList ¶
func ExtractNodeDataFromList[T *Node[T]](list []*Node[T]) []T
Types ¶
type Marshaller ¶
type Node ¶
type Node[T any] struct { ID uuid.UUID `json:"id"` Data T Type string `json:"type"` IsOpen bool `json:"open,omitempty"` // Container only // contains filtered or unexported fields }
func (*Node[T]) ChildrenElemByID ¶
func (n *Node[T]) ChildrenElemByID()
func (*Node[T]) ChildrenElemByIndex ¶
func (n *Node[T]) ChildrenElemByIndex()
func (*Node[T]) ChildrenElemByName ¶
func (n *Node[T]) ChildrenElemByName()
func (*Node[T]) ChildrenElemByPath ¶
func (n *Node[T]) ChildrenElemByPath()
func (*Node[T]) ChildrenElemByType ¶
func (n *Node[T]) ChildrenElemByType()
func (*Node[T]) ChildrenLastElem ¶
func (n *Node[T]) ChildrenLastElem()
func (*Node[T]) ChildrenLen ¶
func (n *Node[T]) ChildrenLen()
func (*Node[T]) ChildrenMoveTo ¶
func (n *Node[T]) ChildrenMoveTo()
func (*Node[T]) ChildrenRemoveByID ¶
func (n *Node[T]) ChildrenRemoveByID()
func (*Node[T]) ChildrenRemoveByIndex ¶
func (n *Node[T]) ChildrenRemoveByIndex()
func (*Node[T]) ChildrenRemoveByName ¶
func (n *Node[T]) ChildrenRemoveByName()
func (*Node[T]) ChildrenRemoveByPath ¶
func (n *Node[T]) ChildrenRemoveByPath()
func (*Node[T]) ChildrenReset ¶
func (n *Node[T]) ChildrenReset()
func (*Node[T]) ChildrenSum ¶
func (n *Node[T]) ChildrenSum(parent *Node[T]) *Node[T]
func (*Node[T]) ChildrenSwap ¶
func (n *Node[T]) ChildrenSwap()
func (*Node[T]) CreateItem ¶
func (n *Node[T]) CreateItem(parent *Node[T], data T) *Node[T]
func (*Node[T]) FindByIndex ¶
func (*Node[T]) FindByName ¶
func (*Node[T]) FindByPath ¶
func (*Node[T]) FindByType ¶
func (*Node[T]) HasChildren ¶
func (n *Node[T]) HasChildren() bool
func (*Node[T]) InsertByID ¶
func (*Node[T]) InsertByIndex ¶
func (*Node[T]) InsertByName ¶
func (*Node[T]) InsertByPath ¶
func (*Node[T]) InsertByType ¶
func (*Node[T]) InsertItem ¶
func (*Node[T]) MarshalBinary ¶
func (*Node[T]) MarshalJSON ¶
func (*Node[T]) MarshalText ¶
func (*Node[T]) MarshalXML ¶
func (n *Node[T]) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Node[T]) RemoveByID ¶
func (*Node[T]) RemoveByIndex ¶
func (*Node[T]) RemoveByName ¶
func (*Node[T]) RemoveByPath ¶
func (*Node[T]) RemoveSelf ¶
func (*Node[T]) SetChildren ¶
func (n *Node[T]) SetChildren(children []*Node[T])
func (*Node[T]) SetFormatRowCallback ¶
func (n *Node[T]) SetFormatRowCallback(formatRowCallback func(*Node[T]) string)
func (*Node[T]) UnmarshalBinary ¶
func (*Node[T]) UnmarshalJSON ¶
func (*Node[T]) UnmarshalText ¶
func (*Node[T]) UnmarshalXML ¶
func (n *Node[T]) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
func (*Node[T]) UpdateByID ¶
func (*Node[T]) UpdateByIndex ¶
func (*Node[T]) UpdateByName ¶
func (*Node[T]) UpdateByPath ¶
func (*Node[T]) UpdateByType ¶
func (*Node[T]) WalkContainer ¶
func (n *Node[T]) WalkContainer(callback func(node *Node[T]))
type Provider ¶
type Provider[T any] interface { Walk(callback func(node *Node[T])) WalkContainer(callback func(node *Node[T])) Clone(newParent *Node[T], preserveID bool) *Node[T] CopyFrom(from *Node[T]) ApplyTo(to *Node[T]) UUID() uuid.UUID Depth() int Parent() *Node[T] SetParent(parent *Node[T]) Sort(cmp func(a T, b T) bool) RemoveByID(id uuid.UUID) RemoveByName(id uuid.UUID) RemoveByIndex(id uuid.UUID) RemoveSelf(id uuid.UUID) RemoveByPath(id uuid.UUID) AddChild(child *Node[T]) InsertItem(parentID uuid.UUID, data T) *Node[T] CreateItem(parent *Node[T], data T) *Node[T] InsertByID(id uuid.UUID) *Node[T] InsertByName(id uuid.UUID) *Node[T] InsertByIndex(id uuid.UUID) *Node[T] InsertByType(id uuid.UUID) *Node[T] InsertByPath(id uuid.UUID) *Node[T] FindByID(id uuid.UUID) *Node[T] FindByName(id uuid.UUID) *Node[T] FindByIndex(id uuid.UUID) *Node[T] FindByPath(id uuid.UUID) *Node[T] FindByType(id uuid.UUID) *Node[T] UpdateByID(id uuid.UUID, data T) UpdateByName(id uuid.UUID, data T) UpdateByIndex(id uuid.UUID, data T) UpdateByPath(id uuid.UUID, data T) UpdateByType(id uuid.UUID, data T) Container() bool HasChildren() bool Children() []*Node[T] SetChildren(children []*Node[T]) GetType() string SetType(t string) Open() bool SetOpen(open bool) ChildrenLen() ChildrenSwap() ChildrenMoveTo() ChildrenLastElem() ChildrenElemByID() ChildrenElemByName() ChildrenElemByIndex() ChildrenElemByType() ChildrenElemByPath() ChildrenReset() ChildrenRemoveByID() ChildrenRemoveByName() ChildrenRemoveByIndex() ChildrenRemoveByPath() ChildrenSum(parent *Node[T]) *Node[T] SetHeader(header []string) SetFormatRowCallback(formatRowCallback func(*Node[T]) string) Format(root *Node[T]) string String() string Enabled() bool Marshaller[T] Unmarshaler[T] // contains filtered or unexported methods }
type Unmarshaler ¶
type Unmarshaler[T any] interface { xml.Unmarshaler json.Unmarshaler encoding.TextUnmarshaler encoding.BinaryUnmarshaler Unmarshal(tree Provider[T]) (objectPtr any, err error) }
Click to show internal directories.
Click to hide internal directories.