42ab71e964
Signed-off-by: Anton Nesterov <anton@demiurg.io>
23 lines
343 B
Go
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)
|
|
}
|