plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 5 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

This section is empty.

Variables

This section is empty.

Functions

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) 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.

Jump to

Keyboard shortcuts

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