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