Skip to content

Commit a3b76df

Browse files
author
Dean Karn
authored
Fixed CONTAINS_ANY for string contains comparisons with slice/array. (#11)
1 parent 7d4240f commit a3b76df

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.5.1] - 2022-10-18
10+
### Fixed
11+
- Fixed CONTAINS_ANY for string contains comparisons with slice/array.
12+
913
## [0.5.0] - 2022-10-13
1014
### Added
1115
- Added new `_lowercase_` COERCE identifier.
@@ -48,8 +52,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4852
### Added
4953
- Initial conversion from https://github.com/rust-playground/ksql.
5054

51-
[Unreleased]: https://github.com/go-playground/ksql/compare/v0.5.0...HEAD
52-
[0.4.0]: https://github.com/go-playground/ksql/compare/v0.4.0...v0.5.0
55+
[Unreleased]: https://github.com/go-playground/ksql/compare/v0.5.1...HEAD
56+
[0.5.1]: https://github.com/go-playground/ksql/compare/v0.5.0...v0.5.1
57+
[0.5.0]: https://github.com/go-playground/ksql/compare/v0.4.0...v0.5.0
5358
[0.4.0]: https://github.com/go-playground/ksql/compare/v0.3.2...v0.4.0
5459
[0.3.2]: https://github.com/go-playground/ksql/compare/v0.3.1...v0.3.2
5560
[0.3.1]: https://github.com/go-playground/ksql/compare/v0.3.0...v0.3.1

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ksql
22
=====
3-
![Project status](https://img.shields.io/badge/version-0.5.0-green.svg)
3+
![Project status](https://img.shields.io/badge/version-0.5.1-green.svg)
44
[![GoDoc](https://godoc.org/github.com/go-playground/ksql?status.svg)](https://pkg.go.dev/github.com/go-playground/ksql)
55
![License](https://img.shields.io/dub/l/vibe-d.svg)
66

parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ func (c containsAny) Calculate(src []byte) (any, error) {
11011101
if !ok {
11021102
continue
11031103
}
1104-
if l == s {
1104+
if strings.Contains(l, s) {
11051105
return true, nil
11061106
}
11071107
}

parser_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ func TestParser(t *testing.T) {
590590
src: `{"f1":"dean","f2":"DeAN"}`,
591591
expected: true,
592592
},
593+
{
594+
name: "CONTAINS_ANY contains, lowercase",
595+
exp: `COERCE .Name _lowercase_ CONTAINS_ANY ["dodgers","yankees","tigers"]`,
596+
src: `{"Name":"The New York Yankees"}`,
597+
expected: true,
598+
},
593599
}
594600

595601
for _, tc := range tests {

0 commit comments

Comments
 (0)