github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/pkg/domain/entities/reports/prune.go (about) 1 package reports 2 3 type PruneReport struct { 4 Id string `json:"Id"` //nolint 5 Err error `json:"Err,omitempty"` 6 Size uint64 `json:"Size"` 7 } 8 9 func PruneReportsIds(r []*PruneReport) []string { 10 ids := make([]string, 0, len(r)) 11 for _, v := range r { 12 if v == nil || v.Id == "" { 13 continue 14 } 15 ids = append(ids, v.Id) 16 } 17 return ids 18 } 19 20 func PruneReportsErrs(r []*PruneReport) []error { 21 errs := make([]error, 0, len(r)) 22 for _, v := range r { 23 if v == nil || v.Err == nil { 24 continue 25 } 26 errs = append(errs, v.Err) 27 } 28 return errs 29 } 30 31 func PruneReportsSize(r []*PruneReport) uint64 { 32 size := uint64(0) 33 for _, v := range r { 34 if v == nil { 35 continue 36 } 37 size += v.Size 38 } 39 return size 40 }