dal/pkg/filters/Or.go

23 lines
343 B
Go
Raw Permalink Normal View History

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
}
2024-08-08 17:26:29 +00:00
func (a Or) FromJSON(data interface{}) IFilter {
return FromJson[Or](data)
}