-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
I have found that sol.Scan doesn't serialize JSON Variables. The issue seems to come from the convertAssignAny method's case engine.Compound branch.
When I add this logging
if err := iter.Err(); err != nil {
fmt.Println("convertAssignAny compound iteration err", err)
return errConversion
}
I get this output
convertAssignAny compound iteration err error(type_error(list,json([=(id,someid),=(message,foobar)])),put_char/2)
Here is an example that hits this error
results(ResultJSON) :-
...
ResultJSON = json([
id = ResultID,
message = Message
]).type Solution struct {
Result any `prolog:"ResultJSON"`
}
// Also fails with
// type Solution struct {
// Result struct {
// ID string `json:"id"`
// Message string `json:"message"`
// } `prolog:"ResultJSON"`
// }
sols, err := p.Query(`results(ResultJSON).`)
...
for sols.Next() {
var s Solution
if err := sols.Scan(&s); err != nil {
...
}
...
}The Go code returns this error failed to run prolog eval: conversion failed from sols.Scan(&s)
Is there a way to get this Scan working? Or does does the library code need to change internally to support this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels