Commit e24f92b7 authored by johnnyjoy's avatar johnnyjoy

fix: tests

parent b55904a4
...@@ -208,17 +208,9 @@ func (d *DB) convertWithParameterIndex(ctx *filter.ConvertContext, expr *exprv1. ...@@ -208,17 +208,9 @@ func (d *DB) convertWithParameterIndex(ctx *filter.ConvertContext, expr *exprv1.
placeholder := filter.GetParameterPlaceholder(dbType, paramIndex) placeholder := filter.GetParameterPlaceholder(dbType, paramIndex)
var sqlTemplate string var sqlTemplate string
if operator == "=" { if operator == "=" {
if valueBool {
sqlTemplate = fmt.Sprintf("(%s->'payload'->'property'->>'%s')::boolean = %s", filter.GetSQL("table_prefix", dbType), strings.TrimPrefix(jsonPath, "$.property."), placeholder) sqlTemplate = fmt.Sprintf("(%s->'payload'->'property'->>'%s')::boolean = %s", filter.GetSQL("table_prefix", dbType), strings.TrimPrefix(jsonPath, "$.property."), placeholder)
} else {
sqlTemplate = fmt.Sprintf("(%s->'payload'->'property'->>'%s')::boolean = %s", filter.GetSQL("table_prefix", dbType), strings.TrimPrefix(jsonPath, "$.property."), placeholder)
}
} else { // operator == "!=" } else { // operator == "!="
if valueBool {
sqlTemplate = fmt.Sprintf("(%s->'payload'->'property'->>'%s')::boolean != %s", filter.GetSQL("table_prefix", dbType), strings.TrimPrefix(jsonPath, "$.property."), placeholder) sqlTemplate = fmt.Sprintf("(%s->'payload'->'property'->>'%s')::boolean != %s", filter.GetSQL("table_prefix", dbType), strings.TrimPrefix(jsonPath, "$.property."), placeholder)
} else {
sqlTemplate = fmt.Sprintf("(%s->'payload'->'property'->>'%s')::boolean != %s", filter.GetSQL("table_prefix", dbType), strings.TrimPrefix(jsonPath, "$.property."), placeholder)
}
} }
if _, err := ctx.Buffer.WriteString(sqlTemplate); err != nil { if _, err := ctx.Buffer.WriteString(sqlTemplate); err != nil {
return paramIndex, err return paramIndex, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment