dal/pkg/filters/Or.go

23 lines
323 B
Go
Raw Normal View History

package filters
import (
"fmt"
"strings"
)
type Or struct {
Or []string `json:"$or"`
}
func (f Or) ToSQLPart(ctx Context) string {
if f.Or == nil {
return ""
}
value := strings.Join(f.Or, " OR ")
return fmt.Sprintf("(%s)", value)
}
2024-08-08 17:26:29 +00:00
func (a Or) FromJSON(data interface{}) IFilter {
return FromJson[Or](data)
}