2024-08-07 19:16:40 +00:00
|
|
|
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 {
|
2024-08-07 19:16:40 +00:00
|
|
|
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)
|
|
|
|
}
|