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

23 lines
359 B
Go

package filters
import (
"fmt"
)
type Lte struct {
Lte interface{} `json:"$lte"`
}
func (f Lte) FromJSON(data interface{}) IFilter {
return FromJson[Lte](data)
}
func (f Lte) ToSQLPart(ctx Context) string {
if f.Lte == nil {
return ""
}
name := ctx.GetFieldName()
value := ctx.NormalizeValue(f.Lte)
return fmt.Sprintf("%s <= %v", name, value)
}