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

23 lines
332 B
Go

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