Sort childrens in ls: /v1/ls/path/to/node
This commit is contained in:
parent
38c820280e
commit
0cc4c91e01
@ -3,6 +3,7 @@ package rest
|
|||||||
import (
|
import (
|
||||||
"github.com/samuel/go-zookeeper/zk"
|
"github.com/samuel/go-zookeeper/zk"
|
||||||
"log"
|
"log"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -26,7 +27,7 @@ type Zk struct {
|
|||||||
func (conf Zk) InitConnection() (*zk.Conn, error) {
|
func (conf Zk) InitConnection() (*zk.Conn, error) {
|
||||||
conn, _, err := zk.Connect(conf.Hosts, time.Second)
|
conn, _, err := zk.Connect(conf.Hosts, time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panic("[ERROR] ", err)
|
log.Fatal("[ERROR] ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return conn, err
|
return conn, err
|
||||||
@ -77,6 +78,9 @@ func (z ZooNode) GetChildrens(path string) Ls {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// Sort childrens alphabeticaly
|
||||||
|
sort.Strings(childrens)
|
||||||
|
|
||||||
l.Error = ""
|
l.Error = ""
|
||||||
l.Childrens = childrens
|
l.Childrens = childrens
|
||||||
l.ZkStat = zkStat
|
l.ZkStat = zkStat
|
||||||
|
Loading…
Reference in New Issue
Block a user