chore: upgrade dependencies

This commit is contained in:
2022-06-09 12:30:53 +02:00
parent 7203f3d6a1
commit dcb93ec8f7
518 changed files with 27809 additions and 3222 deletions

View File

@@ -564,3 +564,38 @@ func ToTimeMap(vs map[string]*time.Time) map[string]time.Time {
return ps
}
// ToDuration returns time.Duration value dereferenced if the passed
// in pointer was not nil. Returns a time.Duration zero value if the
// pointer was nil.
func ToDuration(p *time.Duration) (v time.Duration) {
if p == nil {
return v
}
return *p
}
// ToDurationSlice returns a slice of time.Duration values, that are
// dereferenced if the passed in pointer was not nil. Returns a time.Duration
// zero value if the pointer was nil.
func ToDurationSlice(vs []*time.Duration) []time.Duration {
ps := make([]time.Duration, len(vs))
for i, v := range vs {
ps[i] = ToDuration(v)
}
return ps
}
// ToDurationMap returns a map of time.Duration values, that are
// dereferenced if the passed in pointer was not nil. The time.Duration
// zero value is used if the pointer was nil.
func ToDurationMap(vs map[string]*time.Duration) map[string]time.Duration {
ps := make(map[string]time.Duration, len(vs))
for k, v := range vs {
ps[k] = ToDuration(v)
}
return ps
}