MCPcopy
hub / github.com/robfig/cron / getField

Function getField

parser.go:236–247  ·  view source on GitHub ↗

getField returns an Int with the bits set representing all of the times that the field represents or error parsing field value. A "field" is a comma-separated list of "ranges".

(field string, r bounds)

Source from the content-addressed store, hash-verified

234// the field represents or error parsing field value. A "field" is a comma-separated
235// list of "ranges".
236func getField(field string, r bounds) (uint64, error) {
237 var bits uint64
238 ranges := strings.FieldsFunc(field, func(r rune) bool { return r == ',' })
239 for _, expr := range ranges {
240 bit, err := getRange(expr, r)
241 if err != nil {
242 return bits, err
243 }
244 bits |= bit
245 }
246 return bits, nil
247}
248
249// getRange returns the bits indicated by the given expression:
250// number | number "-" number [ "/" number ]

Callers 2

TestFieldFunction · 0.85
ParseMethod · 0.85

Calls 1

getRangeFunction · 0.85

Tested by 1

TestFieldFunction · 0.68