Documentation
¶
Overview ¶
Package rules provides Expensor rule document, fixture, and merge utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
Document is the versioned rules.json shape.
func ParseDocument ¶
ParseDocument parses versioned v2 rules and the legacy array format.
type EmailFixture ¶
type EmailFixture struct {
TestName string `yaml:"-"`
Rule string `yaml:"rule"`
Sender string `yaml:"sender"`
Subject string `yaml:"subject"`
Body string `yaml:"-"`
Expected EmailFixtureExpectation `yaml:"expected"`
}
EmailFixture is one positive email example for one rule. The rule regexes are intentionally not part of the fixture; tests load those from rules.json.
func LoadEmailFixtures ¶
func LoadEmailFixtures(dir string) ([]EmailFixture, error)
LoadEmailFixtures discovers rule-email fixtures from dir and returns them sorted by filename.
type EmailFixtureExpectation ¶
type EmailFixtureExpectation struct {
Amount float64 `yaml:"amount"`
Merchant string `yaml:"merchant"`
Currency string `yaml:"currency"`
}
EmailFixtureExpectation is the extraction result expected from a fixture.
type PersistedStore ¶
type PersistedStore interface {
ListRules(ctx context.Context, tenant store.Tenant) ([]store.RuleRow, error)
}
PersistedStore provides the tenant rule rows needed by LoadPersisted.
type PresetValue ¶
PresetValue identifies whether a taxonomy value is shipped or user-created.
type Presets ¶
type Presets struct {
SourceTypes []PresetValue `json:"source_types"`
Banks []PresetValue `json:"banks"`
}
Presets lists source taxonomy values shown by rule authoring UIs.