MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / parseDays

Function parseDays

go/engine/node/trigger/alarm.go:117–130  ·  view source on GitHub ↗
(days []string)

Source from the content-addressed store, hash-verified

115}
116
117func parseDays(days []string) ([]time.Weekday, error) {
118 if len(days) == 0 {
119 return nil, nil
120 }
121 out := make([]time.Weekday, 0, len(days))
122 for _, d := range days {
123 wd, ok := dayToWeekday[strings.ToLower(d)]
124 if !ok {
125 return nil, fmt.Errorf("unknown day %q", d)
126 }
127 out = append(out, wd)
128 }
129 return out, nil
130}
131
132func containsWeekday(xs []time.Weekday, w time.Weekday) bool {
133 return slices.Contains(xs, w)

Callers 2

TestParseDaysFunction · 0.85
NewAlarmFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseDaysFunction · 0.68