dal/pkg/filters/And.go
Anton Nesterov 42ab71e964
[ref] use sfmt arguments i/of values in find expressions
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-12 20:21:47 +02:00

23 lines
352 B
Go

package filters
import (
"fmt"
"strings"
)
type And struct {
And []string `json:"$and"`
}
func (f And) ToSQLPart(ctx Dialect) (string, Values) {
if f.And == nil {
return "", nil
}
value := strings.Join(f.And, " AND ")
return fmt.Sprintf("(%s)", value), nil
}
func (a And) FromJSON(data interface{}) IFilter {
return FromJson[And](data)
}