Compare commits

...

1 commit

Author SHA1 Message Date
Arnas Udovic
ecfd279d7e fix GetRandomNode
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-03-16 21:22:31 +02:00
3 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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")

View file

@ -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")