mockstage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mockstage implements the internal deterministic mock stage.

Index

Constants

View Source
const Name = "mock"

Name identifies this stage in classifications, stats, and logs.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Matchers []Matcher
	Default  *Outcome
}

Config declares a mock stage: ordered matchers tried first-match-wins, and an optional default outcome for records no matcher hits. Without a default, unmatched records escalate with ErrUnclassified.

type Matcher

type Matcher struct {
	Contains   []string
	Category   string
	Confidence float64
}

Matcher scores records whose payload contains any of the substrings.

type Outcome

type Outcome struct {
	Category   string
	Confidence float64
}

Outcome is a category scored with a fixed confidence.

type Stage

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

Stage scores records with declared confidences.

func New

func New(cfg Config) (*Stage, error)

New validates and compiles the config. At least one matcher or a default is required; every outcome needs a category and a confidence in [0, 1].

func (*Stage) Classify

Classify implements classmesh.Stage: the first matcher whose substring hits the payload returns its outcome; otherwise the default applies, or the record escalates with ErrUnclassified.

func (*Stage) Name

func (s *Stage) Name() string

Name implements classmesh.Stage.

Jump to

Keyboard shortcuts

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