goqu
goqu copied to clipboard
Can slice as a parameter to select?
Hi First of all, thank you very much for providing such a great tool. col := []string{"a","b"} goqu.From("test").Select(col) Can slice as a parameter to select? The values of the columns are passed from the front end (the user can choose which columns to display) so I need to pass the parameters through the slices. Best Regards Tony
You could set you slice and pass it in variadic (<slice>...
) fashion:
col := []string{"a","b"}
goqu.From("test").Select(col...)
See also WithStruct example at https://pkg.go.dev/github.com/doug-martin/goqu/v9#SelectDataset.Select which may be more useful to you.