Minio can list timestamps with keys
parent
9ba3eab474
commit
c0d561aa50
7
minio.go
7
minio.go
|
|
@ -2,6 +2,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
@ -11,7 +12,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Minio struct {
|
type Minio struct {
|
||||||
db *minio.Client
|
db *minio.Client
|
||||||
|
ListTimestamps bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMinio(addr, user, pass string) (*Minio, error) {
|
func NewMinio(addr, user, pass string) (*Minio, error) {
|
||||||
|
|
@ -40,6 +42,9 @@ func (m *Minio) List(ns []string, limits ...string) ([]string, error) {
|
||||||
} else if resp.Key > limits[1] {
|
} else if resp.Key > limits[1] {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if m.ListTimestamps {
|
||||||
|
resp.Key = fmt.Sprintf("[%d,%q]", resp.LastModified.UnixNano(), resp.Key)
|
||||||
|
}
|
||||||
keys = append(keys, resp.Key)
|
keys = append(keys, resp.Key)
|
||||||
}
|
}
|
||||||
return keys, nil
|
return keys, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue