-
-
Notifications
You must be signed in to change notification settings - Fork 426
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 we make the fromJSON
function support string pointer?
#739
Comments
Looks like a deref is missing. Could you please share the whole example? |
sure! package main
import (
"fmt"
"github.com/expr-lang/expr"
)
func main() {
jsonString := `{"Num": 1}`
env := map[string]any{
"aJSONString": &jsonString,
}
code := "fromJSON(aJSONString)"
result, err := expr.Eval(code, env)
if err != nil {
panic(err)
}
fmt.Println(result)
}
|
and |
I fixed it! It took me quite a lot of programming, but I figure out the correct way to add support for *type for all builtins. Compiler will add |
The current
fromJSON
function only supports parameters of type string. If I pass a parameter of type *string, it throws an error.The text was updated successfully, but these errors were encountered: