You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have been using govaluate in my code since a long time.. but I faced this issue very recently..
The issue is described as
I wrote my custom function names as len which definition is as below..
And what am I doing is passing empty array to this function and writing an expression which says => len(array) != 0
The logs I recieved
Evaluating expression: len(array) != 0 with params: map[array:[]]
and it's giving the result as true that length is not equals to 0.. while the function logs are
Received args: []interface{}{}
But the same thing when I tried with the len(args) as a string.. by using strconv.Itoa(len(args)) and did len(array) != '0' it worked..
May someone please help me out here.
The text was updated successfully, but these errors were encountered:
len(args) is the length of argments of function,you pass an argment to funtion, so length of argment is one. the argment's value is []interface{}{}, array is it's real type. if you want to get len(array). you must type assert at first. just like this:
arr := args[0].([]interface{}), then len(arr)
Hi, I have been using govaluate in my code since a long time.. but I faced this issue very recently..
The issue is described as
I wrote my custom function names as len which definition is as below..
And what am I doing is passing empty array to this function and writing an expression which says =>
len(array) != 0
The logs I recieved
and it's giving the result as true that length is not equals to 0.. while the function logs are
But the same thing when I tried with the len(args) as a string.. by using
strconv.Itoa(len(args))
and didlen(array) != '0'
it worked..May someone please help me out here.
The text was updated successfully, but these errors were encountered: