Skip to content

Commit

Permalink
Add MYSQL json case-insensitive search
Browse files Browse the repository at this point in the history
  • Loading branch information
KinyaElGrande authored and Fajfa committed Aug 22, 2023
1 parent 6999a9f commit b78bb7b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/store/adapters/rdbms/drivers/mysql/dialect.go
Expand Up @@ -62,6 +62,7 @@ func (d mysqlDialect) JsonExtract(jsonDoc exp.Expression, pp ...any) (path exp.E
if path, err = jsonPathExpr(pp...); err != nil {
return
} else {
path = exp.NewCastExpression(path, "CHAR")
return exp.NewSQLFunctionExpression("JSON_EXTRACT", jsonDoc, path), nil
}
}
Expand Down Expand Up @@ -239,6 +240,11 @@ func (d mysqlDialect) ExprHandler(n *ql.ASTNode, args ...exp.Expression) (expr e

case "nin":
return drivers.OpHandlerNotIn(d, n, args...)

case "like":
for a := range args {
args[a] = exp.NewLiteralExpression("LOWER(?)", args[a])
}
}

return ref2exp.RefHandler(n, args...)
Expand Down

0 comments on commit b78bb7b

Please sign in to comment.