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

no query.NotIn(...interface{}) ? #48

Closed
mh-cbon opened this issue Jun 13, 2019 · 4 comments
Closed

no query.NotIn(...interface{}) ? #48

mh-cbon opened this issue Jun 13, 2019 · 4 comments

Comments

@mh-cbon
Copy link

mh-cbon commented Jun 13, 2019

hi,

i cant find the NotIn verb in the query implementation. Am i missing something obvious ?

@timshannon
Copy link
Owner

Currently there isn't one. You could accomplish the same with with a MatchFunc query:

bolthold.Where("Name").MatchFunc(func(ra *bolthold.RecordAccess) (bool, error) {
			field := ra.Field()
			val, ok := field.(string)
			if !ok {
				return false, fmt.Errorf("Field not a string, it's a %T!", field)
			}

			return val != "one" && val != "two" && val != "three"
		}),

@mh-cbon
Copy link
Author

mh-cbon commented Jun 15, 2019

Don t you think it deserves to be part of the standard querier API ?

@timshannon
Copy link
Owner

Not necessarily, no. I'd prefer to have a more general Not modifier that could be applied to any query criterion rather than have one single negative logic critierion that be accomplished with MatchFunc.

@timshannon
Copy link
Owner

You can now do Not().In("one", "two", "three") type of queries with #52

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

No branches or pull requests

2 participants