From ecfd279d7e32e1f55d64aada0817603c07f8f230 Mon Sep 17 00:00:00 2001 From: Arnas Udovic Date: Sun, 16 Mar 2025 21:22:31 +0200 Subject: [PATCH] fix GetRandomNode --- CHANGELOG | 4 ++++ zordfsdb.go | 2 +- zordfsdb_test.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9418ad5..bf02749 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v1.0.7, released 2025-03-16 + * bugfixes + - GetRandomNode public command + v1.0.6, released 2025-03-16 * features - Node.Get - get object property value diff --git a/zordfsdb.go b/zordfsdb.go index 2c88cd1..9cf1fa4 100644 --- a/zordfsdb.go +++ b/zordfsdb.go @@ -338,7 +338,7 @@ func (db *DB) Length(vpath string) (int64, error) { return int64(len(node.Nodes)), nil } -func (db *DB) getRandomNode(vpath string) (Node, error) { +func (db *DB) GetRandomNode(vpath string) (Node, error) { node, found := db.GetNode(vpath) if !found { return Node{}, fmt.Errorf("Node not found") diff --git a/zordfsdb_test.go b/zordfsdb_test.go index 7499d79..ebd9db4 100644 --- a/zordfsdb_test.go +++ b/zordfsdb_test.go @@ -266,7 +266,7 @@ func TestListRandomNode(t *testing.T) { node, _ := db.GetNode("object.list3") node.FixType() - node, _ = db.getRandomNode("object.list3") + node, _ = db.GetRandomNode("object.list3") if node.Nodes["key"].Value != "value" { fmt.Println(node) t.Fatal("Random node value wrong")