|
|
|
@ -208,17 +208,9 @@ func (d *DB) convertWithParameterIndex(ctx *filter.ConvertContext, expr *exprv1.
|
|
|
|
|
placeholder := filter.GetParameterPlaceholder(dbType, paramIndex)
|
|
|
|
|
var sqlTemplate string
|
|
|
|
|
if operator == "=" {
|
|
|
|
|
if valueBool {
|
|
|
|
|
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 == "!="
|
|
|
|
|
if valueBool {
|
|
|
|
|
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 {
|
|
|
|
|
return paramIndex, err
|
|
|
|
|