dal/pkg/filters/Lte.go
Anton Nesterov 43dd4e9234
[ref] name things what they are
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-11 21:49:49 +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 Dialect) string {
if f.Lte == nil {
return ""
}
name := ctx.GetFieldName()
value := ctx.NormalizeValue(f.Lte)
return fmt.Sprintf("%s <= %v", name, value)
}