filter

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package filter provides a BPF-inspired expression language for filtering decoded NMEA 2000 frames by field values.

Expressions support boolean logic (&&, ||, !), comparison operators (==, !=, <, >, <=, >=), and dotted field access for lookup sub-fields.

Example expressions:

"pgn == 130310 && water_temperature < 280"
"register.name == \"State of Charge\""
"pgn == 61184 || pgn == 130310"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvalContext

type EvalContext struct {
	PGN     uint32
	Src     uint8
	Dst     uint8
	Prio    uint8
	Decoded any               // decoded PGN struct, nil if unavailable
	Lookups map[string]string // from LookupFields(), nil if unavailable
}

EvalContext provides the data a filter expression is evaluated against.

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter is a compiled display filter expression.

func Compile

func Compile(expr string) (*Filter, error)

Compile parses and compiles a filter expression string. Returns an error if the expression is syntactically invalid.

func (*Filter) Match

func (f *Filter) Match(ctx *EvalContext) bool

Match evaluates the filter against the given context.

func (*Filter) NeedsDecode

func (f *Filter) NeedsDecode() bool

NeedsDecode returns true if the expression references decoded fields (anything other than pgn, src, dst, prio).

func (*Filter) String

func (f *Filter) String() string

String returns a human-readable representation of the filter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL