squirrel icon indicating copy to clipboard operation
squirrel copied to clipboard

add support for slice to the Expr

Open rande opened this issue 9 years ago • 6 comments

This code allows to get an slice of parameters in an expression

rande avatar Dec 04 '14 22:12 rande

Could you show an example of where this would be helpful?

lann avatar Dec 04 '14 23:12 lann

@lann here the usage : https://github.com/rande/gonode/blob/master/extra/goji.go#L129

This feature help me to expand the parameters from the Form struct into valid parameters.

Another solution will be to open the args attributes in the Expr structure

rande avatar Dec 05 '14 01:12 rande

Go itself generally doesn't hide the complexity of e.g. copying a []string to an []interface{} , and I'm inclined to take the same approach here, especially since you can't generalize it for all slice types (beyond the string/int you have here) without reflection.

Given that you only need to use []string's here, would it make sense to just have an e.g. stringsToIfaces helper func?

lann avatar Dec 05 '14 21:12 lann

Unfortunately I will not be able to review or merge major changes for the forseeable future; see README.

lann avatar Jul 29 '15 04:07 lann

Lann has moved Squirrel to the Masterminds project, and is still the architect, but @mattfarina and I will be helping him maintain. We'll start reviewing pull requests and see if we can get this in.

technosophos avatar Jul 29 '15 16:07 technosophos

Another use case - PostgreSQL array intersection: squirrel.Expr("tags && ?", tagSlice)

c2h5oh avatar Feb 10 '16 16:02 c2h5oh