Fix listing buckets and also figure out how to do so
parent
518ffe6364
commit
d3a169ae19
12
cli/main.go
12
cli/main.go
|
|
@ -21,6 +21,8 @@ func main() {
|
|||
as.Append(args.STRING, "k", "key", "key")
|
||||
as.Append(args.STRING, "v", "value", "value")
|
||||
as.Append(args.STRING, "ns", "namespace", "")
|
||||
as.Append(args.STRING, "min", "min key to list", "---")
|
||||
as.Append(args.STRING, "max", "max key to list", "}}}")
|
||||
if err := as.Parse(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -40,12 +42,10 @@ func main() {
|
|||
switch strings.ToLower(as.Get("do").GetString()) {
|
||||
case "list":
|
||||
var c []string
|
||||
var ns []string
|
||||
if nss := as.Get("ns").GetString(); len(ns) > 0 {
|
||||
ns = []string{nss}
|
||||
}
|
||||
c, err = db.List(ns, as.Get("k").GetString())
|
||||
b = []byte(fmt.Sprintf("%v", c))
|
||||
ns := strings.Split(as.Get("ns").GetString(), " ")
|
||||
c, err = db.List(ns, as.Get("min").GetString(), as.Get("max").GetString())
|
||||
d := strings.Join(c, "\n\t")
|
||||
b = []byte(fmt.Sprintf("%s", d))
|
||||
case "get":
|
||||
b, err = db.Get(as.Get("k").GetString())
|
||||
case "set":
|
||||
|
|
|
|||
3
minio.go
3
minio.go
|
|
@ -30,6 +30,9 @@ func (m *Minio) List(ns []string, limits ...string) ([]string, error) {
|
|||
defer close(done)
|
||||
keys := []string{}
|
||||
for resp := range m.db.ListObjects(namespace, "", true, done) {
|
||||
if resp.Err != nil {
|
||||
return keys, resp.Err
|
||||
}
|
||||
if resp.Key < limits[0] {
|
||||
continue
|
||||
} else if resp.Key > limits[1] {
|
||||
|
|
|
|||
Loading…
Reference in New Issue