| 1234567891011121314151617181920212223242526272829 |
- package core
- import "TsDB2/DB/core/types"
- type LeCondition struct {
- Field string
- Value interface{}
- Type types.FieldType
- }
- func Le(field string, value interface{}, typ types.FieldType) Condition {
- return LeCondition{Field: field, Value: value, Type: typ}
- }
- func (c LeCondition) Fields() []string {
- return []string{c.Field}
- }
- func (c LeCondition) Match(row []byte, table *Table) bool {
- fieldIdx := table.findFieldIndex(c.Field)
- if fieldIdx < 0 {
- return false
- }
- offset, ok := table.getVersionedOffset(row, fieldIdx)
- if !ok {
- return false
- }
- return table.compareLessOrEqual(row, offset, c.Type, c.Value)
- }
|