Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the expression support arrays or slices as input parameters? #188

Open
yaduomo-1990 opened this issue Nov 1, 2023 · 0 comments
Open

Comments

@yaduomo-1990
Copy link

yaduomo-1990 commented Nov 1, 2023

like this:

expr4, err := govaluate.NewEvaluableExpression("dept_id in (dept_arr)")
	assert.Nil(t, err)
	parameters = make(map[string]interface{})
	parameters["dept_id"] = 20
	arr := make([]int, 3)
	arr[0] = 10
	arr[1] = 20
	arr[2] = 30
	parameters["dept_arr"] = arr
	// or-------------------------------
	parameters["dept_arr"] = []int{10,20}
	result, err = expr4.Evaluate(parameters)
	assert.Nil(t, err)
	fmt.Println("----------------")
	fmt.Println(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant