From 0d3c5c6c30f54a866ace37b3910c224bc0a739fe Mon Sep 17 00:00:00 2001 From: Roman Volosatovs Date: Thu, 13 Apr 2017 10:43:54 +0200 Subject: [PATCH] viper.go: GetDurationSlice --- viper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/viper.go b/viper.go index 5ca66ae..72b1932 100644 --- a/viper.go +++ b/viper.go @@ -684,6 +684,12 @@ func (v *Viper) GetDuration(key string) time.Duration { return cast.ToDuration(v.Get(key)) } +// GetDurationSlice returns the value associated with the key as a slice of durations. +func GetDurationSlice(key string) []string { return v.GetDurationSlice(key) } +func (v *Viper) GetDurationSlice(key string) []string { + return cast.ToDurationSlice(v.Get(key)) +} + // GetStringSlice returns the value associated with the key as a slice of strings. func GetStringSlice(key string) []string { return v.GetStringSlice(key) } func (v *Viper) GetStringSlice(key string) []string {