support GetNodes interface
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
cb02d4a1c5
commit
2234d83153
1 changed files with 12 additions and 0 deletions
12
zordfsdb.go
12
zordfsdb.go
|
@ -10,6 +10,10 @@ import (
|
||||||
"g.arns.lt/zordsdavini/abcex"
|
"g.arns.lt/zordsdavini/abcex"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type GetNodes interface {
|
||||||
|
GetNodes() map[string]Node
|
||||||
|
}
|
||||||
|
|
||||||
type DB struct {
|
type DB struct {
|
||||||
Root string
|
Root string
|
||||||
Nodes map[string]Node
|
Nodes map[string]Node
|
||||||
|
@ -23,6 +27,14 @@ type Node struct {
|
||||||
List bool
|
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) {
|
func InitDB(root string) (DB, error) {
|
||||||
db := DB{Root: root}
|
db := DB{Root: root}
|
||||||
err := db.Refresh()
|
err := db.Refresh()
|
||||||
|
|
Loading…
Reference in a new issue