| 37 | } |
| 38 | |
| 39 | func (e *ExpressSet) IsMatch(t time.Time) bool { |
| 40 | switch e.expressType { |
| 41 | case ExpressType_WeekDay: |
| 42 | _, ok := e.timeMap[int(t.Weekday())] |
| 43 | return ok |
| 44 | case ExpressType_Month: |
| 45 | _, ok := e.timeMap[int(t.Month())] |
| 46 | return ok |
| 47 | case ExpressType_Day: |
| 48 | _, ok := e.timeMap[int(t.Day())] |
| 49 | return ok |
| 50 | case ExpressType_Hour: |
| 51 | _, ok := e.timeMap[int(t.Hour())] |
| 52 | return ok |
| 53 | case ExpressType_Minute: |
| 54 | _, ok := e.timeMap[int(t.Minute())] |
| 55 | return ok |
| 56 | case ExpressType_Second: |
| 57 | _, ok := e.timeMap[int(t.Second())] |
| 58 | return ok |
| 59 | default: |
| 60 | return false |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | parse express |