Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 9, 2023
2 parents f3516c6 + 2c4c264 commit 8a245a3
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions kernel/av/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ func (value *Value) Compare(other *Value) int {
return 0
}
}
if nil != value.Created && nil != other.Created {
if value.Created.Content > other.Created.Content {
return 1
} else if value.Created.Content < other.Created.Content {
return -1
} else {
return 0
}
}
if nil != value.Updated && nil != other.Updated {
if value.Updated.Content > other.Updated.Content {
return 1
} else if value.Updated.Content < other.Updated.Content {
return -1
} else {
return 0
}
}

if nil != value.MSelect && nil != other.MSelect {
var v1 string
Expand Down Expand Up @@ -245,6 +263,62 @@ func (value *Value) CompareOperator(other *Value, operator FilterOperator) bool
}
}

if nil != value.Created && nil != other.Created {
switch operator {
case FilterOperatorIsEqual:
return value.Created.Content == other.Created.Content
case FilterOperatorIsNotEqual:
return value.Created.Content != other.Created.Content
case FilterOperatorIsGreater:
return value.Created.Content > other.Created.Content
case FilterOperatorIsGreaterOrEqual:
return value.Created.Content >= other.Created.Content
case FilterOperatorIsLess:
return value.Created.Content < other.Created.Content
case FilterOperatorIsLessOrEqual:
return value.Created.Content <= other.Created.Content
case FilterOperatorIsBetween:
start := value.Created.Content >= other.Created.Content
end := value.Created.Content <= other.Created.Content2
return start && end
case FilterOperatorIsEmpty:
return !value.Created.IsNotEmpty
case FilterOperatorIsNotEmpty:
return value.Created.IsNotEmpty
case FilterOperatorIsRelativeToToday:
// TODO: date filter (relative to today)
return value.Date.Content >= other.Date.Content && value.Date.Content <= other.Date.Content2
}
}

if nil != value.Updated && nil != other.Updated {
switch operator {
case FilterOperatorIsEqual:
return value.Updated.Content == other.Updated.Content
case FilterOperatorIsNotEqual:
return value.Updated.Content != other.Updated.Content
case FilterOperatorIsGreater:
return value.Updated.Content > other.Updated.Content
case FilterOperatorIsGreaterOrEqual:
return value.Updated.Content >= other.Updated.Content
case FilterOperatorIsLess:
return value.Updated.Content < other.Updated.Content
case FilterOperatorIsLessOrEqual:
return value.Updated.Content <= other.Updated.Content
case FilterOperatorIsBetween:
start := value.Updated.Content >= other.Updated.Content
end := value.Updated.Content <= other.Updated.Content2
return start && end
case FilterOperatorIsEmpty:
return !value.Updated.IsNotEmpty
case FilterOperatorIsNotEmpty:
return value.Updated.IsNotEmpty
case FilterOperatorIsRelativeToToday:
// TODO: date filter (relative to today)
return value.Date.Content >= other.Date.Content && value.Date.Content <= other.Date.Content2
}
}

if nil != value.MSelect && nil != other.MSelect && 0 < len(value.MSelect) && 0 < len(other.MSelect) {
switch operator {
case FilterOperatorIsEqual, FilterOperatorContains:
Expand Down

0 comments on commit 8a245a3

Please sign in to comment.