Skip to content

Commit

Permalink
#234 Fixed issue found by CI linter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzhang6222 committed May 12, 2020
1 parent 6aaf621 commit 2da4140
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions syntax/std_seq.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ func process(apiName string, args ...rel.Value) rel.Value {
return handler(args...)
}

// This seq API handlders mapping, the key is API name + '_' + data type.
// This seq API handlders mapping.
var (
handlerMapping = map[typeMethod]func(...rel.Value) rel.Value{
// API contains
typeMethod{reflect.TypeOf(rel.String{}), "contains"}: func(args ...rel.Value) rel.Value {
return rel.NewBool(strings.Contains(mustAsString(args[0]), mustAsString(args[1])))
},

typeMethod{reflect.TypeOf(rel.Array{}), "contains"}: func(args ...rel.Value) rel.Value {
return ArrayContains(args[0].(rel.Array), args[1])
},

typeMethod{reflect.TypeOf(rel.Bytes{}), "contains"}: func(args ...rel.Value) rel.Value {
return nil
},

typeMethod{reflect.TypeOf(rel.String{}), "contains"}: func(args ...rel.Value) rel.Value {
return rel.NewBool(strings.Contains(mustAsString(args[0]), mustAsString(args[1])))
},
// API sub
typeMethod{reflect.TypeOf(rel.String{}), "sub"}: func(args ...rel.Value) rel.Value {
return rel.NewString(
Expand Down

0 comments on commit 2da4140

Please sign in to comment.