registry

package
v0.0.0-...-1d0517d Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

package registry provides a registry of plugins. This is used to register plugins that will be used by a workstream plan.

Usage:

package main

import (
	"github.com/element-of-surprise/plugins/github" // Doesn't really exist, example name
	"github.com/element-of-surprise/coercion/registry"
)

func main() {
	reg := registry.New()
	if err := reg.Register(github.New()); err != nil {
		// handle error
	}
	...
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Register

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

Register provides a Register for plugins. This should not be used directly by the user, but instead via the Registry variable. Use of this type directly is not supported.

func New

func New() *Register

New creates a new Register. Not for use by the user.

func (*Register) MustRegister

func (r *Register) MustRegister(p plugins.Plugin)

MustRegister registers a plugin by name. It panics if their is an error registering the plugin.

func (*Register) Plugin

func (r *Register) Plugin(name string) plugins.Plugin

Plugin returns a plugin by name. It returns nil if the plugin is not found.

func (*Register) Plugins

func (r *Register) Plugins() iter.Seq[plugins.Plugin]

Plugins returns a channel of all the plugins in the registry.

func (*Register) Register

func (r *Register) Register(p plugins.Plugin) error

Register registers a plugin by name. It panics if the name is empty, the plugin is nil, or a plugin is already registered with the same name. This can only be called during init, otherwise the behavior is undefined. Not safe for concurrent use.

Jump to

Keyboard shortcuts

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