Skip to content

Commit 36eb902

Browse files
committed
(chore)Add extended operations to cmd jl.
1 parent 568b2c7 commit 36eb902

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

jl/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ import (
77
"os"
88

99
"github.com/huangjunwen/jsonlogic-go"
10+
"github.com/huangjunwen/jsonlogic-go/ext"
1011
)
1112

1213
func outputErrorAndExit(err error) {
1314
fmt.Fprintln(os.Stderr, err)
1415
os.Exit(1)
1516
}
1617

18+
func init() {
19+
// Add extensions.
20+
ext.AddOpRange(jsonlogic.DefaultJSONLogic)
21+
}
22+
1723
func main() {
1824
var (
1925
logic, data interface{}
@@ -30,7 +36,7 @@ func main() {
3036
}
3137
}
3238

33-
result, err := jsonlogic.New().Apply(logic, data)
39+
result, err := jsonlogic.Apply(logic, data)
3440
if err != nil {
3541
outputErrorAndExit(err)
3642
return

0 commit comments

Comments
 (0)