2024-08-08 09:09:17 +00:00
|
|
|
package filters
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Or struct {
|
|
|
|
Or []string `json:"$or"`
|
|
|
|
}
|
|
|
|
|
2024-08-11 19:49:19 +00:00
|
|
|
func (f Or) ToSQLPart(ctx Dialect) string {
|
2024-08-08 09:09:17 +00:00
|
|
|
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 {
|
2024-08-08 09:09:17 +00:00
|
|
|
return FromJson[Or](data)
|
|
|
|
}
|