dal/pkg/filters/Lte.go

23 lines
359 B
Go
Raw Normal View History

package filters
import (
"fmt"
)
type Lte struct {
Lte interface{} `json:"$lte"`
}
2024-08-08 17:26:29 +00:00
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)
}