File tree Expand file tree Collapse file tree 6 files changed +39
-8
lines changed Expand file tree Collapse file tree 6 files changed +39
-8
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased]
8
8
9
+ ## [ 0.6.1] - 2023-05-25
10
+ ### Fixed
11
+ - Fixed AND and OR not early exiting evaluation.
12
+
9
13
## [ 0.6.0] - 2023-01-05
10
14
### Added
11
15
- Added new ` _uppercase_ ` & ` _title_ ` COERCE identifiers.
@@ -58,7 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
58
62
### Added
59
63
- Initial conversion from https://github.com/rust-playground/ksql .
60
64
61
- [ Unreleased ] : https://github.com/go-playground/ksql/compare/v0.6.0...HEAD
65
+ [ Unreleased ] : https://github.com/go-playground/ksql/compare/v0.6.1...HEAD
66
+ [ 0.6.1 ] : https://github.com/go-playground/ksql/compare/v0.6.0...v0.6.1
62
67
[ 0.6.0 ] : https://github.com/go-playground/ksql/compare/v0.5.1...v0.6.0
63
68
[ 0.5.1 ] : https://github.com/go-playground/ksql/compare/v0.5.0...v0.5.1
64
69
[ 0.5.0 ] : https://github.com/go-playground/ksql/compare/v0.4.0...v0.5.0
Original file line number Diff line number Diff line change 1
1
ksql
2
2
=====
3
- ![ Project status] ( https://img.shields.io/badge/version-0.5 .1-green.svg )
3
+ ![ Project status] ( https://img.shields.io/badge/version-0.6 .1-green.svg )
4
4
[ ![ GoDoc] ( https://godoc.org/github.com/go-playground/ksql?status.svg )] ( https://pkg.go.dev/github.com/go-playground/ksql )
5
5
![ License] ( https://img.shields.io/dub/l/vibe-d.svg )
6
6
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ go 1.18
4
4
5
5
require (
6
6
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
7
- github.com/go-playground/pkg/v5 v5.11.0
7
+ github.com/go-playground/itertools v0.1.0
8
+ github.com/go-playground/pkg/v5 v5.18.0
8
9
github.com/stretchr/testify v1.8.1
9
10
github.com/tidwall/gjson v1.14.4
10
11
)
11
12
12
13
require (
13
14
github.com/davecgh/go-spew v1.1.1 // indirect
14
- github.com/go-playground/itertools v0.1.0 // indirect
15
15
github.com/pmezard/go-difflib v1.0.0 // indirect
16
16
github.com/tidwall/match v1.1.1 // indirect
17
17
github.com/tidwall/pretty v1.2.0 // indirect
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoU
3
3
github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
4
4
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
5
5
github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
6
+ github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s =
6
7
github.com/go-playground/itertools v0.1.0 h1:isiUTLIViAz4J3qWrowvRoOYWSXy2ubkXKNJfujE3Sc =
7
8
github.com/go-playground/itertools v0.1.0 /go.mod h1:+TD1WVpn32jr+GpvO+nnb2xXD45SSzt18Fo/C0y9PJE =
8
- github.com/go-playground/pkg/v5 v5.11 .0 h1:yYYmh0RLKBxiLbEwO7HZtp8XVDDuyIqHmhtrmuO0nsg =
9
- github.com/go-playground/pkg/v5 v5.11 .0 /go.mod h1:eT8XZeFHnqZkfkpkbI8ayjfCw9GohV2/j8STbVmoR6s =
9
+ github.com/go-playground/pkg/v5 v5.18 .0 h1:qnYuhWhwLdWj6ut9jagFjaiUI6PZTo3SafR5Um9w214 =
10
+ github.com/go-playground/pkg/v5 v5.18 .0 /go.mod h1:eT8XZeFHnqZkfkpkbI8ayjfCw9GohV2/j8STbVmoR6s =
10
11
github.com/mattn/go-runewidth v0.0.10 /go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk =
11
12
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM =
12
13
github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
Original file line number Diff line number Diff line change @@ -879,6 +879,7 @@ func (e eq) Calculate(src []byte) (any, error) {
879
879
if err != nil {
880
880
return nil , err
881
881
}
882
+
882
883
return reflect .DeepEqual (left , right ), nil
883
884
}
884
885
@@ -1027,6 +1028,7 @@ func (n not) Calculate(src []byte) (any, error) {
1027
1028
if err != nil {
1028
1029
return nil , err
1029
1030
}
1031
+
1030
1032
switch t := value .(type ) {
1031
1033
case bool :
1032
1034
return ! t , nil
@@ -1047,6 +1049,14 @@ func (o or) Calculate(src []byte) (any, error) {
1047
1049
if err != nil {
1048
1050
return nil , err
1049
1051
}
1052
+
1053
+ switch t := left .(type ) {
1054
+ case bool :
1055
+ if t {
1056
+ return true , nil
1057
+ }
1058
+ }
1059
+
1050
1060
right , err := o .right .Calculate (src )
1051
1061
if err != nil {
1052
1062
return nil , err
@@ -1076,6 +1086,16 @@ func (a and) Calculate(src []byte) (any, error) {
1076
1086
if err != nil {
1077
1087
return nil , err
1078
1088
}
1089
+
1090
+ switch t := left .(type ) {
1091
+ case bool :
1092
+ if ! t {
1093
+ return false , nil
1094
+ }
1095
+ default :
1096
+ return false , nil
1097
+ }
1098
+
1079
1099
right , err := a .right .Calculate (src )
1080
1100
if err != nil {
1081
1101
return nil , err
Original file line number Diff line number Diff line change 1
1
package ksql
2
2
3
3
import (
4
+ "github.com/stretchr/testify/require"
4
5
"testing"
5
6
"time"
6
-
7
- "github.com/stretchr/testify/require"
8
7
)
9
8
10
9
func TestParser (t * testing.T ) {
@@ -620,6 +619,12 @@ func TestParser(t *testing.T) {
620
619
src : `{"name":"mr."}` ,
621
620
expected : "Mr." ,
622
621
},
622
+ {
623
+ name : "NOT NULL AND" ,
624
+ exp : `.MyValue != NULL && .MyValue > 19` ,
625
+ src : `{}` ,
626
+ expected : false ,
627
+ },
623
628
}
624
629
625
630
for _ , tc := range tests {
You can’t perform that action at this time.
0 commit comments