mirror of
https://github.com/go-task/task.git
synced 2025-03-19 21:17:46 +02:00
19 lines
466 B
Go
19 lines
466 B
Go
|
package read
|
||
|
|
||
|
// BaseNode is a generic node that implements the Parent() and Optional()
|
||
|
// methods of the NodeReader interface. It does not implement the Read() method
|
||
|
// and it designed to be embedded in other node types so that this boilerplate
|
||
|
// code does not need to be repeated.
|
||
|
type BaseNode struct {
|
||
|
parent Node
|
||
|
optional bool
|
||
|
}
|
||
|
|
||
|
func (node *BaseNode) Parent() Node {
|
||
|
return node.parent
|
||
|
}
|
||
|
|
||
|
func (node *BaseNode) Optional() bool {
|
||
|
return node.optional
|
||
|
}
|