registry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry holds all registered actions and associated types, and provides methods to register, query, and look up actions.

func New

func New() *Registry

New creates a new root registry.

func (*Registry) Dotprompt added in v0.3.0

func (r *Registry) Dotprompt() *dotprompt.Dotprompt

Dotprompt returns the dotprompt instance.

func (*Registry) IsChild added in v0.7.0

func (r *Registry) IsChild() bool

IsChild returns true if the registry is a child of another registry.

func (*Registry) ListActions

func (r *Registry) ListActions() []api.Action

ListActions returns a list of all registered actions. This includes actions from both the current registry and its parent hierarchy. Child registry actions take precedence over parent actions with the same key.

func (*Registry) ListPlugins added in v0.6.0

func (r *Registry) ListPlugins() []api.Plugin

ListPlugins returns a list of all registered plugins.

func (*Registry) ListValues added in v0.5.0

func (r *Registry) ListValues() map[string]any

ListValues returns a list of values of all registered values. This includes values from both the current registry and its parent hierarchy. Child registry values take precedence over parent values with the same key.

func (*Registry) LookupAction

func (r *Registry) LookupAction(key string) api.Action

LookupAction returns the action for the given key. It first checks the current registry, then falls back to the parent if not found.

func (*Registry) LookupPlugin added in v0.3.0

func (r *Registry) LookupPlugin(name string) api.Plugin

LookupPlugin returns the plugin for the given name. It first checks the current registry, then falls back to the parent if not found. Returns nil if the plugin is not found in the registry hierarchy.

func (*Registry) LookupValue added in v0.3.0

func (r *Registry) LookupValue(name string) any

LookupValue returns the value for the given name. It first checks the current registry, then falls back to the parent if not found. Returns nil if the value is not found in the registry hierarchy.

func (*Registry) NewChild added in v0.6.0

func (r *Registry) NewChild() api.Registry

NewChild creates a new child registry that inherits from this registry. Child registries are cheap to create and will fall back to the parent for lookups if a value is not found in the child.

func (*Registry) RegisterAction

func (r *Registry) RegisterAction(key string, action api.Action)

RegisterAction records the action in the registry. It panics if an action with the same type, provider and name is already registered.

func (*Registry) RegisterHelper added in v0.7.0

func (r *Registry) RegisterHelper(name string, fn any)

RegisterHelper adds a helper function to the dotprompt instance

func (*Registry) RegisterPartial added in v0.7.0

func (r *Registry) RegisterPartial(name string, source string)

RegisterPartial adds the partial to the list of partials to the dotprompt instance

func (*Registry) RegisterPlugin added in v0.3.0

func (r *Registry) RegisterPlugin(name string, p api.Plugin)

RegisterPlugin records the plugin in the registry. It panics if a plugin with the same name is already registered.

func (*Registry) RegisterValue added in v0.3.0

func (r *Registry) RegisterValue(name string, value any)

RegisterValue records an arbitrary value in the registry. It panics if a value with the same name is already registered.

func (*Registry) ResolveAction added in v0.6.2

func (r *Registry) ResolveAction(key string) api.Action

ResolveAction looks up an action by key. If the action is not found, it attempts dynamic resolution. Returns the action if found, or nil if not found.

Jump to

Keyboard shortcuts

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