support GetNodes interface
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Arnas Udovic 2024-08-29 17:42:30 +03:00
parent cb02d4a1c5
commit 2234d83153

View file

@ -10,6 +10,10 @@ import (
"g.arns.lt/zordsdavini/abcex"
)
type GetNodes interface {
GetNodes() map[string]Node
}
type DB struct {
Root string
Nodes map[string]Node
@ -23,6 +27,14 @@ type Node struct {
List bool
}
func (db *DB) GetNodes() map[string]Node {
return db.Nodes
}
func (node *Node) GetNodes() map[string]Node {
return node.Nodes
}
func InitDB(root string) (DB, error) {
db := DB{Root: root}
err := db.Refresh()