rencalo770 / gengine

Rule Engine for Golang
Other
433 stars 70 forks source link

Is there any example for use StopTag #7

Closed shiqstone closed 4 years ago

shiqstone commented 4 years ago

I try to compose rule like this

rule "whitelist" "use in white list pass" salience 10
BEGIN
    if InWhitelist(userNo) {
        // pass
    } else {
        // continue
    }
END
rule "blacklist" "use in black list deny" salience 5
BEGIN
    if InBlacklist(User.UserNo) {
            // deny
        }
END
...

how can i use ExecuteWithStopTag achieve stop run rest rule if user in whitelist?

rencalo770 commented 4 years ago

It is a good issue!and thanks for your issue! here, I wrote two test for you, see https://github.com/rencalo770/gengine/tree/master/test/stop_tag_test and, please use the newest version v1.1.8 of gengine

and for simplify to use, I delete the func "ExecuteWithStopTag" and "ExecuteMixModelWithStopTag", and keep "ExecuteWithStopTagDirect" and "ExecuteMixModelWithStopTagDirect" for users.

shiqstone commented 4 years ago

It is a good issue!and thanks for your issue! here, I wrote two test for you, see https://github.com/rencalo770/gengine/tree/master/test/stop_tag_test and, please use the newest version v1.1.8 of gengine

and for simplify to use, I delete the func "ExecuteWithStopTag" and "ExecuteMixModelWithStopTag", and keep "ExecuteWithStopTagDirect" and "ExecuteMixModelWithStopTagDirect" for users.

good job, it works, thanks!