crontabex/condition_base.go
huangsimin cc9071bc70 save
2018-12-26 19:10:53 +08:00

53 lines
750 B
Go

package crontab
func Add(v ...interface{}) interface{} {
return nil
}
func Sub(v ...interface{}) interface{} {
return nil
}
func Div(v ...interface{}) interface{} {
return nil
}
func Mul(v ...interface{}) interface{} {
return nil
}
func Or(v ...interface{}) interface{} {
return nil
}
func And(v ...interface{}) interface{} {
return nil
}
func parseConditionExpr(condExpr string) []string {
var conds []string
OpenClose := 0
cur := 0
i := 0
for ; i < len(condExpr); i++ {
switch condExpr[i] {
case ',':
if OpenClose == 0 {
conds = append(conds, condExpr[cur:i])
cur = i + 1
}
case '(':
OpenClose++
case ')':
OpenClose--
}
}
if cur < i {
conds = append(conds, condExpr[cur:i])
}
return conds
}