Пример #1
0
func stringAsDuration(durationStr string, unit units.Unit) (
	result time.Duration, err error) {
	dur, err := duration.ParseWithUnit(durationStr, unit)
	if err != nil {
		return
	}
	result = dur.AsGoDuration()
	return
}
Пример #2
0
func stringAsTime(timeStr string, unit units.Unit) (
	result time.Time, err error) {
	dur, err := duration.ParseWithUnit(timeStr, unit)
	if err != nil {
		return
	}
	result = dur.AsGoTime()
	return
}