package
module
Version:
v0.1.2
Opens a new window with list of versions in this module.
Published: Nov 26, 2021
License: Unlicense
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 6
Opens a new window with list of known importers.
README
¶
go-tree
Guidelines
- AddChild panics if node is closed or child name is taken.
- Processes are not closed when their node closes but they do close their node on exit.
- Children are closed asynchronously in a go routine different from the one calling their parent close.
- Children autoremove from parent but do not close parent.
- Children that need to auto close their parent must explicitly add a closer pointing to their parent.
- Use IfRecoverX to ensure close of resources when add child or add process panics
Documentation
¶
type Node interface {
Name() string
State() *State
AddChild(name string) Node
GetValue(name string) interface{}
SetValue(name string, value interface{})
AddProcess(name string, action func())
AddAction(name string, action func())
AddCloser(name string, action func() error)
AddChannel(name string, channel chan interface{})
IfRecoverAction(action func())
IfRecoverCloser(action func() error)
IfRecoverChannel(channel chan interface{})
Disposed() <-chan interface{}
Closed() <-chan interface{}
Println(args ...interface{})
PanicIfError(err error)
WaitDisposed()
WaitClosed()
Recover()
Close()
}
func NewRoot(name string, log func(args ...interface{})) Node
type Reversed interface {
Count() int
Names() []string
Values() []interface{}
Get(string) interface{}
Set(string, interface{})
Remove(string) interface{}
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.