56
56
}
57
57
)
58
58
59
+ // MustParse returns the same result as Parse but it panic
60
+ // when something is wrong.
59
61
func MustParseInLocation (expr string , locName string ) * Schedule {
60
62
loc , err := time .LoadLocation (locName )
61
63
if err != nil {
@@ -71,6 +73,10 @@ func MustParseInLocation(expr string, locName string) *Schedule {
71
73
return schdule
72
74
}
73
75
76
+ // ParseInLocation parse the expression in the location and
77
+ // returns a new schedule representing the given spec.
78
+ // It returns an error when loading the location is failed or
79
+ // the syntax of the expression is wrong.
74
80
func ParseInLocation (expr string , locName string ) (* Schedule , error ) {
75
81
loc , err := time .LoadLocation (locName )
76
82
if err != nil {
@@ -86,6 +92,8 @@ func ParseInLocation(expr string, locName string) (*Schedule, error) {
86
92
return schdule , nil
87
93
}
88
94
95
+ // MustParse returns the same result as Parse but it panic
96
+ // when the syntax of expression is wrong.
89
97
func MustParse (expr string ) * Schedule {
90
98
s , err := Parse (expr )
91
99
if err != nil {
@@ -95,6 +103,9 @@ func MustParse(expr string) *Schedule {
95
103
return s
96
104
}
97
105
106
+ // Parse parses the expression and returns a new schedule representing the given spec.
107
+ // And the default location of a schedule is "UTC".
108
+ // It returns an error when the syntax of expression is wrong.
98
109
func Parse (expr string ) (* Schedule , error ) {
99
110
err := verifyExpr (expr )
100
111
if err != nil {
0 commit comments