package cronFormat type bounds struct { min int max int all []int } func (p bounds) inRange(v int) bool { if v < p.min || v > p.max { return false } return true } var ( years = bounds{2022, 2040, []int{ 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, }} months = bounds{1, 12, []int{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, }} dom = bounds{1, 31, []int{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }} dow = bounds{1, 7, []int{ //周一:1 周日:7 1, 2, 3, 4, 5, 6, 7, }} hours = bounds{0, 24, []int{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, }} minutes = bounds{0, 59, []int{ 0, 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, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, }} // seconds = bounds{0, 59, []int{ // 0, 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, 34, 35, 36, 37, 38, 39, 40, // 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, // 51, 52, 53, 54, 55, 56, 57, 58, 59, // }} )