Skip to content
Discussion options

You must be logged in to vote

Both add_new_patch and make_new_patch are functions, but you are referencing them as if they were rules. I can't say I fully understand what you're trying to accomplish, but if you just want to make the function call conditionally, something like this would do it:

package play

make_new_patch(path, value) = patchCode {
    patchCode = {
        "op": "make",
        "path": path,
        "value": value
    }
}

add_new_patch(path, value) = patchCode {
    patchCode = {
        "op": "add",
        "path": path,
        "value": value,
        "comment": "not make"
    }
}

hello = add_new_patch("some_path", "some_value") {
	input.message == "add"
} else = make_new_patch("other_path", "oth…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhoupoko2000
Comment options

Answer selected by zhoupoko2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants