dal/pkg/filters/Or.go
Anton Nesterov 42ab71e964
[ref] use sfmt arguments i/of values in find expressions
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-12 20:21:47 +02:00

23 lines
343 B
Go

package filters
import (
"fmt"
"strings"
)
type Or struct {
Or []string `json:"$or"`
}
func (f Or) ToSQLPart(ctx Dialect) (string, Values) {
if f.Or == nil {
return "", nil
}
value := strings.Join(f.Or, " OR ")
return fmt.Sprintf("(%s)", value), nil
}
func (a Or) FromJSON(data interface{}) IFilter {
return FromJson[Or](data)
}