Skip to content

Commit

Permalink
Fix ILIKE operator to create ILIKE node
Browse files Browse the repository at this point in the history
  • Loading branch information
Delisa-sama committed Oct 4, 2022
1 parent 0c6e2b0 commit b4e8076
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion operators/ilike.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ func ILIKE(value string) statement.Operator {

// Node returns EqNode
func (o ilike) Node(leftOp string) nodes.Node {
return nodes.NewLikeNode(nodes.NewNameNode(leftOp), nodes.NewStringNode(o.value))
return nodes.NewILikeNode(nodes.NewNameNode(leftOp), nodes.NewStringNode(o.value))
}
6 changes: 3 additions & 3 deletions translators/sql_translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ func TestSQLTranslator_Translate(t *testing.T) {
{
name: "single statement LIKE expression",
placeholder: nil,
s: statement.New("name", operators.ILIKE("%abc%")),
s: statement.New("name", operators.LIKE("%abc%")),
want: " WHERE name LIKE '%abc%'",
},
{
name: "single statement LIKE expression",
name: "single statement ILIKE expression",
placeholder: nil,
s: statement.New("name", operators.ILIKE("%abc%")).Limit(1).Offset(5),
want: " WHERE name LIKE '%abc%' LIMIT 1 OFFSET 5",
want: " WHERE name ILIKE '%abc%' LIMIT 1 OFFSET 5",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit b4e8076

Please sign in to comment.