Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for slice to the Expr #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add support for slice to the Expr #33

wants to merge 1 commit into from

Conversation

rande
Copy link
Contributor

@rande rande commented Dec 4, 2014

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

@lann
Copy link
Member

lann commented Dec 4, 2014

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

@rande
Copy link
Contributor Author

rande commented Dec 5, 2014

@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

@lann
Copy link
Member

lann commented Dec 5, 2014

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
Copy link
Member

lann commented Jul 29, 2015

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

@technosophos
Copy link
Member

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.

@c2h5oh
Copy link

c2h5oh commented Feb 10, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants