Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CompileStats ¶
type CompileStats struct {
Patterns int
Accelerated int
AlwaysRun int
Bounded int
SensitiveTriggers int
CaselessTriggers int
MaskTriggers int
HashTriggers int
HashLiterals int
PairTriggers int
RunGuards int
GuardClasses int
DFAPatterns int
DFAStates int
}
CompileStats describes the routing decisions made while compiling a database.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is an immutable block-mode multi-pattern database.
func Compile ¶
Compile builds one block database from patterns. Patterns must be trusted; compilation does not enforce resource budgets.
func UnmarshalDatabase ¶
UnmarshalDatabase loads compiled tables without compiling expressions. It rejects incompatible formats and corrupt data and does not retain data. Only load artifacts produced by a trusted compiler; the checksum is not a signature.
func (*Database) Marshal ¶
Marshal encodes the compiled database in an architecture-independent format. The output can be embedded with go:embed. Format versions are library-specific.
func (*Database) Scan ¶
func (db *Database) Scan(data []byte, scratch *Scratch, handler MatchHandler) error
Scan searches data and calls handler for every reported match.
func (*Database) Stats ¶
func (db *Database) Stats() CompileStats
Stats returns counts useful when tuning a pattern set.
type MatchHandler ¶
MatchHandler receives matches in engine order. Returning an error stops the scan and returns that error.
type Pattern ¶
Pattern associates an expression and compile flags with an application ID.
func NewPattern ¶
NewPattern returns a pattern with the supplied expression and flags.