Slices being spread out into values
icholy opened this issue · 4 comments
icholy commented
What's the use case for this behaviour?
package main
import (
"fmt"
lk "github.com/ulule/loukoum"
)
func main() {
fmt.Println(
lk.Insert("foo").Set(
lk.Pair("a", []int{1, 2, 3}),
).String(),
)
}
output:
INSERT INTO foo (a) VALUES (1, 2, 3)
Where is stmt.Array
actually useful?
icholy commented
Ok, so I've read through the code and it looks like the problem is that NewExpression
and NewArrayExpression
are calling each other recursively. Would you guys be opposed to using reflection to handle the arrays?
novln commented
It's definitely a corner case, but we trust loukoum's user to known how to generate a valid SQL query.
However, we could add a type checking to ensure pair's value has a valid type here:
Line 27 in b658af1
What do you think @thoas & @gillesfabio ?