MCPcopy Create free account
hub / github.com/codnect/chrono / checkValidValue

Function checkValidValue

cron.go:309–325  ·  view source on GitHub ↗
(value string, fieldType fieldType)

Source from the content-addressed store, hash-verified

307}
308
309func checkValidValue(value string, fieldType fieldType) (int, error) {
310 result, err := strconv.Atoi(value)
311
312 if err != nil {
313 return 0, fmt.Errorf("the value in field %s must be number : %s", fieldType.Field, value)
314 }
315
316 if fieldType.Field == cronFieldDayOfWeek && result == 0 {
317 return result, nil
318 }
319
320 if result >= fieldType.MinValue && result <= fieldType.MaxValue {
321 return result, nil
322 }
323
324 return 0, fmt.Errorf("the value in field %s must be between %d and %d", fieldType.Field, fieldType.MinValue, fieldType.MaxValue)
325}
326
327func getTimeValue(t time.Time, field cronField) int {
328

Callers 1

parseRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected