unionmatch

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 2 Imported by: 0 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 unionmatch owns exact-one selection across schema and carrier domains.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEvaluated

func CheckEvaluated(name string, members, evaluated []string) error

CheckEvaluated rejects instance members absent from the selected branch's evaluated annotations. Call only after Select succeeds on original branches.

func Select

func Select(name string, candidates []Candidate) (int, error)

Select requires a nonempty candidate set and a unique match in both domains on the same candidate. A singleton still runs both independent predicates. It visits every candidate unless a callback fails and never assigns a value.

func SelectSchema

func SelectSchema(name string, candidates []Candidate) (int, error)

SelectSchema requires a nonempty candidate set and exactly one schema match without consulting decoders. A nested union uses this result as its outer schema-domain predicate.

Types

type Candidate

type Candidate struct {
	// Schema checks membership without carrier-width restrictions.
	Schema func() (bool, error)
	// Decode converts and validates without publishing the candidate.
	Decode func() (bool, error)
}

Candidate supplies independent predicates over one private candidate.

type Mismatch

type Mismatch struct {
	// Message describes the rejected union contract.
	Message string
}

Mismatch is an ordinary union contract failure, including nested failures. Configuration, evaluator and application-codec errors retain their causes.

func (*Mismatch) Error

func (e *Mismatch) Error() string

Error returns the contract failure without hiding its classification.

Jump to

Keyboard shortcuts

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