• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / ark / 13597253646

28 Feb 2025 10:03PM CUT coverage: 96.9% (-0.09%) from 96.988%
13597253646

Pull #82

github

web-flow
Merge 52c6f9ea6 into 5263582b2
Pull Request #82: Unsafe filter and query

234 of 242 new or added lines in 3 files covered. (96.69%)

17 existing lines in 1 file now uncovered.

3626 of 3742 relevant lines covered (96.9%)

50664.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/ecs/filter.go
1
package ecs
2

3
// Filter is a filter for components.
4
type Filter struct {
5
        mask       Mask
6
        without    Mask
7
        hasWithout bool
8
}
9

10
// NewFilter creates a new [Filter] matching the given components.
11
func NewFilter(ids ...ID) Filter {
1,081✔
12
        return Filter{
1,081✔
13
                mask: All(ids...),
1,081✔
14
        }
1,081✔
15
}
1,081✔
16

17
// Without specifies components to exclude.
18
// Resets previous excludes.
NEW
19
func (f Filter) Without(ids ...ID) Filter {
×
NEW
20
        f.without = All(ids...)
×
NEW
21
        return f
×
NEW
22
}
×
23

24
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
25
// and no other components are allowed.
26
func (f Filter) Exclusive() Filter {
9✔
27
        f.without = f.mask.Not()
9✔
28
        f.hasWithout = true
9✔
29
        return f
9✔
30
}
9✔
31

32
func (f *Filter) matches(mask *Mask) bool {
2,228✔
33
        return mask.Contains(&f.mask) && (!f.hasWithout || !mask.ContainsAny(&f.without))
2,228✔
34
}
2,228✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc