fix: 调整not规则判断子规则数量,逻辑规则返回payload采用解析后结果
This commit is contained in:
@ -18,19 +18,18 @@ func (not *NOT) ShouldFindProcess() bool {
|
||||
}
|
||||
|
||||
func NewNOT(payload string, adapter string) (*NOT, error) {
|
||||
not := &NOT{Base: &common.Base{}, payload: payload, adapter: adapter}
|
||||
not := &NOT{Base: &common.Base{}, adapter: adapter}
|
||||
rule, err := parseRuleByPayload(payload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(rule) > 1 {
|
||||
return nil, fmt.Errorf("not rule can contain at most one rule")
|
||||
if len(rule) != 1 {
|
||||
return nil, fmt.Errorf("not rule must contain one rule")
|
||||
}
|
||||
|
||||
if len(rule) > 0 {
|
||||
not.rule = rule[0]
|
||||
}
|
||||
not.rule = rule[0]
|
||||
not.payload = fmt.Sprintf("!(%s)", rule[0].Payload())
|
||||
|
||||
return not, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user