5656 }
5757)
5858
59+ // MustParse returns the same result as Parse but it panic
60+ // when something is wrong.
5961func MustParseInLocation (expr string , locName string ) * Schedule {
6062 loc , err := time .LoadLocation (locName )
6163 if err != nil {
@@ -71,6 +73,10 @@ func MustParseInLocation(expr string, locName string) *Schedule {
7173 return schdule
7274}
7375
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.
7480func ParseInLocation (expr string , locName string ) (* Schedule , error ) {
7581 loc , err := time .LoadLocation (locName )
7682 if err != nil {
@@ -86,6 +92,8 @@ func ParseInLocation(expr string, locName string) (*Schedule, error) {
8692 return schdule , nil
8793}
8894
95+ // MustParse returns the same result as Parse but it panic
96+ // when the syntax of expression is wrong.
8997func MustParse (expr string ) * Schedule {
9098 s , err := Parse (expr )
9199 if err != nil {
@@ -95,6 +103,9 @@ func MustParse(expr string) *Schedule {
95103 return s
96104}
97105
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.
98109func Parse (expr string ) (* Schedule , error ) {
99110 err := verifyExpr (expr )
100111 if err != nil {
0 commit comments