-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert.go
33 lines (26 loc) · 926 Bytes
/
convert.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package goscheduler
import "strings"
// convertMarcos will convert common non-standard cron macros into a cron line.
// Returns *string.
func (cron *cron) convertMarcos() *string {
return conversionMacros.conversion(&cron.raw)
}
// convertDaysOfWeek will convert character based version of days of the week into numeric.
// Returns *string.
func (*cron) convertDaysOfWeek(days *string) *string {
return conversionDaysOfWeek.conversion(days)
}
// convertMonths will convert character based version of months into numeric.
// Returns *string.
func (*cron) convertMonths(months *string) *string {
return conversionMonths.conversion(months)
}
// conversion will use the specified conversion struct and convert any found strings.
// Returns *string.
func (conv *conversion) conversion(raw *string) *string {
data := *raw
for key, value := range *conv {
data = strings.Replace(data, key, value, -1)
}
return &data
}