-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: built tree struct to store data
- Loading branch information
1 parent
84af4aa
commit ddfbe28
Showing
8 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package tree | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
) | ||
|
||
type AssignmentNode struct { | ||
parent *AssignmentNode | ||
Name string | ||
URL string | ||
children []*AssignmentNode | ||
} | ||
|
||
func (n *AssignmentNode) AppendChild(c *AssignmentNode) { | ||
log.Default().Println(fmt.Sprintf("Appending child %s to parent %s", c.Name, n.Name)) | ||
c.parent = n | ||
n.children = append(n.children, c) | ||
} | ||
|
||
func BuildAssignmentNode(parent *AssignmentNode, name string, url string) *AssignmentNode { | ||
log.Default().Println(fmt.Sprintf("Building node %s", name)) | ||
node := &AssignmentNode{ | ||
Name: name, | ||
URL: url, | ||
parent: parent, | ||
} | ||
return node | ||
} | ||
func BuildRootAssignmentNode(name string, url string) *AssignmentNode { | ||
return BuildAssignmentNode(nil, name, url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
package ui | ||
|
||
|
||
|