Minio can list timestamps with keys

master
Bel LaPointe 2020-10-09 12:24:01 -06:00
parent 9ba3eab474
commit c0d561aa50
1 changed files with 6 additions and 1 deletions

View File

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