refactor filter operands
Publish / release (push) Successful in 27s

This commit is contained in:
2026-06-26 23:18:46 -04:00
parent 4e683e31bd
commit 385ab85305
4 changed files with 54 additions and 9 deletions
+9 -2
View File
@@ -140,9 +140,15 @@ local, _ := c.Aircraft(ctx,
// OR-composition and negation:
heavies, _ := c.Aircraft(ctx,
readsb.Any(readsb.WithCategory("A5"), readsb.WithType("mlat")),
readsb.Or(readsb.WithCategory("A5"), readsb.WithType("mlat")),
readsb.Not(readsb.OnGround()),
)
// And is the value form of the implicit AND, for nesting inside Or:
nearby, _ := c.Aircraft(ctx, readsb.Or(
readsb.And(readsb.WithCategory("A7"), readsb.WithinNMOf(40.7, -74.0, 5)),
readsb.And(readsb.WithCategory("A7"), readsb.WithinNMOf(41.9, -72.7, 5)),
))
```
| Filter Name | Description | Sample Usage |
@@ -165,7 +171,8 @@ heavies, _ := c.Aircraft(ctx,
| `SeenWithin` | Keeps aircraft heard from within the given duration. | `readsb.SeenWithin(5*time.Minute)` |
| `MinRSSI` | Keeps aircraft whose average signal strength is at or above dbfs (e.g. -24). | `readsb.MinRSSI(-24)` |
| `Not` | Inverts a filter. | `readsb.Not(readsb.OnGround())` |
| `Any` | Keeps aircraft matching at least one of the supplied filters (logical OR). | `readsb.Any(f1, f2)` |
| `And` | Keeps aircraft matching every supplied filter (logical AND). | `readsb.And(f1, f2)` |
| `Or` | Keeps aircraft matching at least one of the supplied filters (logical OR). | `readsb.Or(f1, f2)` |
### Streaming