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