plugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 6 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 plugin implements the named plugin registry.

Index

Constants

View Source
const (
	// AliasDataAPI is the anchor policy plugin API name.
	AliasDataAPI = "alias-data"
	// ErrorFormatAPI is the error-format plugin API name.
	ErrorFormatAPI = "error-format"
	// LoaderLimitsAPI is the loader-limits plugin API name.
	LoaderLimitsAPI = "loader-limits"
	// MergeKeyAPI is the Merge-Key plugin API name.
	MergeKeyAPI = "merge-key"
	// YAMLParserAPI is the YAML-parser plugin API name.
	YAMLParserAPI = "yaml-parser"
)

Variables

This section is empty.

Functions

func AliasDataDisabled added in v0.2.0

func AliasDataDisabled(value any) bool

AliasDataDisabled recognizes the three explicit alias rejection forms.

func ConfigValue

func ConfigValue(api, value string) (map[string]any, error)

ConfigValue converts an implementation short form into registry config.

Types

type Factory

type Factory func(map[string]any) (any, error)

Factory constructs a plugin from its plugin-specific configuration.

type Registration

type Registration struct {
	API     string
	Name    string
	Version string
	Default bool
	Factory Factory
}

Registration describes one named implementation of a plugin API. Version is empty for an unversioned implementation.

type Registry

type Registry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Registry stores named plugin implementations.

func NewRegistry

func NewRegistry(registrations ...Registration) *Registry

NewRegistry creates a registry containing the supplied implementations.

func (*Registry) Create

func (r *Registry) Create(api string, cfg map[string]any) (any, error)

Create resolves and constructs a configured implementation.

func (*Registry) CreateShortForm added in v0.2.0

func (r *Registry) CreateShortForm(api, value string) (any, error)

CreateShortForm resolves a scalar implementation or empty configuration entry. Registered names take precedence over entries in the default implementation. Versioned selectors always identify registered implementations.

func (*Registry) Register

func (r *Registry) Register(registration Registration) error

Register adds a named implementation to the registry.

type Selection

type Selection struct {
	API, Name, Version string
}

Selection identifies one plugin API, implementation, and optional version.

func ParseSelectors

func ParseSelectors(text string) ([]Selection, error)

ParseSelectors parses comma-separated plugin selector syntax.

Directories

Path Synopsis
Package mergekey implements the default Merge-Key algorithm.
Package mergekey implements the default Merge-Key algorithm.

Jump to

Keyboard shortcuts

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