File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ go get -u github.com/johnfercher/go-tree
34
34
* [ AddNext] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.AddNext )
35
35
* [ Backtrack] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.Backtrack )
36
36
* [ Get] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.Get )
37
+ * [ GetNexts] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.GetNexts )
38
+ * [ GetPrevious] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.GetPrevious )
37
39
* [ GetStructure] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.GetStructure )
38
40
* [ IsLeaf] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.IsLeaf )
39
41
* [ IsRoot] ( https://pkg.go.dev/github.com/johnfercher/go-tree/tree#Node.IsLeaf )
Original file line number Diff line number Diff line change @@ -133,6 +133,18 @@ func ExampleNode_GetNexts() {
133
133
// Do more things
134
134
}
135
135
136
+ // ExampleNode_GetPrevious demonstrates how to retrieve next nodes from node.
137
+ func ExampleNode_GetPrevious () {
138
+ root := tree .NewNode (0 , "root" )
139
+ leaf := tree .NewNode (1 , "leaf" )
140
+
141
+ root .AddNext (leaf )
142
+ previous := leaf .GetPrevious ()
143
+ fmt .Println (previous .Get ())
144
+
145
+ // Do more things
146
+ }
147
+
136
148
// ExampleNode_IsRoot demonstrates how to retrieve info if node is root.
137
149
func ExampleNode_IsRoot () {
138
150
n := tree .NewNode (0 , 'b' )
You can’t perform that action at this time.
0 commit comments