80 lines
2.5 KiB
Go
80 lines
2.5 KiB
Go
package envvars
|
|
|
|
import "time"
|
|
|
|
func StringSlice(key, sep string, defaultValue []string) []string {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertString)
|
|
}
|
|
|
|
func ByteSlice(key, sep string, defaultValue []byte) []byte {
|
|
return Uint8Slice(key, sep, defaultValue)
|
|
}
|
|
|
|
func RuneSlice(key, sep string, defaultValue []rune) []rune {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertRune)
|
|
}
|
|
|
|
func IntSlice(key, sep string, defaultValue []int) []int {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertInt)
|
|
}
|
|
|
|
func Int8Slice(key, sep string, defaultValue []int8) []int8 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertInt8)
|
|
}
|
|
|
|
func Int16Slice(key, sep string, defaultValue []int16) []int16 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertInt16)
|
|
}
|
|
|
|
func Int32Slice(key, sep string, defaultValue []int32) []int32 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertInt32)
|
|
}
|
|
|
|
func Int64Slice(key, sep string, defaultValue []int64) []int64 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertInt64)
|
|
}
|
|
|
|
func Uint8Slice(key, sep string, defaultValue []uint8) []uint8 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertUint8)
|
|
}
|
|
|
|
func Uint16Slice(key, sep string, defaultValue []uint16) []uint16 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertUint16)
|
|
}
|
|
|
|
func Uint32Slice(key, sep string, defaultValue []uint32) []uint32 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertUint32)
|
|
}
|
|
|
|
func Uint64Slice(key, sep string, defaultValue []uint64) []uint64 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertUint64)
|
|
}
|
|
|
|
func Float32Slice(key, sep string, defaultValue []float32) []float32 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertFloat32)
|
|
}
|
|
|
|
func Float64Slice(key, sep string, defaultValue []float64) []float64 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertFloat64)
|
|
}
|
|
|
|
func Complex64Slice(key, sep string, defaultValue []complex64) []complex64 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertComplex64)
|
|
}
|
|
|
|
func Complex128Slice(key, sep string, defaultValue []complex128) []complex128 {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertComplex128)
|
|
}
|
|
|
|
func BoolSlice(key, sep string, defaultValue []bool) []bool {
|
|
return ObjectSlice(key, sep, defaultValue, ConvertBool)
|
|
}
|
|
|
|
func TimeSlice(key, sep string, defaultValue []time.Time, layout string) []time.Time {
|
|
return ObjectSlice(key, sep, defaultValue, func(s string) (time.Time, error) { return time.Parse(layout, s) })
|
|
}
|
|
|
|
func DurationSlice(key, sep string, defaultValue []time.Duration) []time.Duration {
|
|
return ObjectSlice(key, sep, defaultValue, time.ParseDuration)
|
|
}
|