mirror of
https://github.com/octoleo/restic.git
synced 2024-11-16 18:15:20 +00:00
Add methods to IDSet
This commit is contained in:
parent
d42ff509ba
commit
5c46dc41de
@ -28,3 +28,22 @@ func (s IDSet) Insert(id ID) {
|
|||||||
func (s IDSet) Delete(id ID) {
|
func (s IDSet) Delete(id ID) {
|
||||||
delete(s, id)
|
delete(s, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List returns a slice of all IDs in the set.
|
||||||
|
func (s IDSet) List() IDs {
|
||||||
|
list := make(IDs, 0, len(s))
|
||||||
|
for id := range s {
|
||||||
|
list = append(list, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s IDSet) String() string {
|
||||||
|
str := s.List().String()
|
||||||
|
if len(str) < 2 {
|
||||||
|
return "{}"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "{" + str[1:len(str)-2] + "}"
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user