fix: tests
This commit is contained in:
parent
b55904a428
commit
e24f92b719
3 changed files with 11 additions and 19 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue