dal/pkg/filters/Or.go
2024-08-08 19:26:29 +02:00

23 lines
323 B
Go

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)
}
func (a Or) FromJSON(data interface{}) IFilter {
return FromJson[Or](data)
}