If I want to query for an array of strings using the golang client, I would use this example:
q := `query all($a: string) {
all(func: eq(name, $a)) {
name
}
}`
res, err := txn.QueryWithVars(ctx, q, map[string]string{"$a": "Alice"})
fmt.Printf("%s\n", res.Json)
and it specifies map[string], since we expect an array of strings.
Now, suppose I want to query for an array of structs, where each struct is an array of strings, such as
q := `query all($a: string) {
all(func: lt(k, $a)) {
l1
l2
l3
l4
}
}` ,
for the structure defined by
var decode struct {
All []struct {
Uid string
l1 string
l2 string
l3 string
l4 string
}
}
what would be the equivalent argument to QueryWithVars? Would it be map[decode]string{"$a": f})
?