tests run (but not pass) and fine-tuning (specially tag filters) on filter_easyjson.go

This commit is contained in:
fiatjaf
2023-04-16 16:12:42 -03:00
parent 0a3e898c2f
commit c42059f4b4
12 changed files with 116 additions and 129 deletions
+10 -10
View File
@@ -9,14 +9,14 @@ import (
type Filters []Filter
type Filter struct {
IDs []string
Kinds []int
Authors []string
Tags TagMap
Since Timestamp
Until Timestamp
Limit int
Search string
IDs []string `json:"ids"`
Kinds []int `json:"kinds"`
Authors []string `json:"authors"`
Tags TagMap `json:"-"`
Since *Timestamp `json:"since"`
Until *Timestamp `json:"until"`
Limit int `json:"limit"`
Search string `json:"search"`
}
type TagMap map[string][]string
@@ -63,11 +63,11 @@ func (ef Filter) Matches(event *Event) bool {
}
}
if event.CreatedAt < ef.Since {
if ef.Since != nil && event.CreatedAt < *ef.Since {
return false
}
if ef.Until != 0 && event.CreatedAt > ef.Until {
if ef.Until != nil && event.CreatedAt > *ef.Until {
return false
}