Commit 0e7b576f authored by Heiko Reese's avatar Heiko Reese
Browse files

Added filtering for results

parent 021b11c6
...@@ -57,6 +57,19 @@ func (r Searchresults) Less(i, j int) bool { ...@@ -57,6 +57,19 @@ func (r Searchresults) Less(i, j int) bool {
} }
} }
// Filter returns the subset of results that match filter
func (r Searchresults) Filter(filter SCFilter) Searchresults {
filtered := make(Searchresults, len(r))
matches := 0
for _, cert := range r {
if filter(cert) {
filtered[matches] = cert
matches++
}
}
return filtered[:matches]
}
func (r Searchresults) JSONString(watchers map[int]*AttributeState) []byte { func (r Searchresults) JSONString(watchers map[int]*AttributeState) []byte {
result := JSONShell{ result := JSONShell{
Results: make([]*JSONResult, len(r)), Results: make([]*JSONResult, len(r)),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment