Skip to content

Commit

Permalink
Merge pull request #44 from deathiop/dev/abarreau/in_equality
Browse files Browse the repository at this point in the history
fix: ValueFilter.IsEquality is false for `in` filters
  • Loading branch information
geoffreybauduin authored Nov 3, 2020
2 parents 4f01be4 + 6763b6c commit a9e7f74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions yaormfilter/tools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func TestEquality(t *testing.T) {

f = yaormfilter.NotEquals("bdef")
assert.False(t, f.IsEquality())

f = yaormfilter.In([]string{"abc", "bdef"})
assert.False(t, f.IsEquality())
}

func TestNotEquals(t *testing.T) {
Expand Down
4 changes: 3 additions & 1 deletion yaormfilter/valuefilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ func (f *valuefilterimpl) like(e interface{}) *valuefilterimpl {
}

func (f *valuefilterimpl) in(e []interface{}) *valuefilterimpl {
return f.equals(e)
return f.raw(func(field string) interface{} {
return squirrel.Eq{field: e}
})
}

func (f *valuefilterimpl) notIn(e []interface{}) *valuefilterimpl {
Expand Down

0 comments on commit a9e7f74

Please sign in to comment.