Skip to content

Commit

Permalink
Fixed CONTAINS_ANY for string contains comparisons with slice/array. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
deankarn committed Oct 18, 2022
1 parent 7d4240f commit a3b76df
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.5.1] - 2022-10-18
### Fixed
- Fixed CONTAINS_ANY for string contains comparisons with slice/array.

## [0.5.0] - 2022-10-13
### Added
- Added new `_lowercase_` COERCE identifier.
Expand Down Expand Up @@ -48,8 +52,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Initial conversion from https://github.com/rust-playground/ksql.

[Unreleased]: https://github.com/go-playground/ksql/compare/v0.5.0...HEAD
[0.4.0]: https://github.com/go-playground/ksql/compare/v0.4.0...v0.5.0
[Unreleased]: https://github.com/go-playground/ksql/compare/v0.5.1...HEAD
[0.5.1]: https://github.com/go-playground/ksql/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/go-playground/ksql/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/go-playground/ksql/compare/v0.3.2...v0.4.0
[0.3.2]: https://github.com/go-playground/ksql/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/go-playground/ksql/compare/v0.3.0...v0.3.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ksql
=====
![Project status](https://img.shields.io/badge/version-0.5.0-green.svg)
![Project status](https://img.shields.io/badge/version-0.5.1-green.svg)
[![GoDoc](https://godoc.org/github.com/go-playground/ksql?status.svg)](https://pkg.go.dev/github.com/go-playground/ksql)
![License](https://img.shields.io/dub/l/vibe-d.svg)

Expand Down
2 changes: 1 addition & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ func (c containsAny) Calculate(src []byte) (any, error) {
if !ok {
continue
}
if l == s {
if strings.Contains(l, s) {
return true, nil
}
}
Expand Down
6 changes: 6 additions & 0 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,12 @@ func TestParser(t *testing.T) {
src: `{"f1":"dean","f2":"DeAN"}`,
expected: true,
},
{
name: "CONTAINS_ANY contains, lowercase",
exp: `COERCE .Name _lowercase_ CONTAINS_ANY ["dodgers","yankees","tigers"]`,
src: `{"Name":"The New York Yankees"}`,
expected: true,
},
}

for _, tc := range tests {
Expand Down

0 comments on commit a3b76df

Please sign in to comment.