plugin

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package plugin provides the interface for Grove plugins and a registry for managing them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin interface {
	// Name returns the plugin identifier.
	Name() string
	// Init is called once when the plugin is registered with a DB.
	Init(ctx context.Context, db any) error
}

Plugin is the interface that all Grove plugins must implement.

type Registry

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

Registry manages registered plugins.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new plugin registry.

func (*Registry) Get

func (r *Registry) Get(name string) Plugin

Get returns a plugin by name, or nil if not found.

func (*Registry) InitAll

func (r *Registry) InitAll(ctx context.Context, db any) error

InitAll initializes all registered plugins.

func (*Registry) Plugins

func (r *Registry) Plugins() []Plugin

Plugins returns all registered plugins.

func (*Registry) Register

func (r *Registry) Register(p Plugin)

Register adds a plugin to the registry.

type WithHooks

type WithHooks interface {
	Plugin
	// RegisterHooks is called to let the plugin register its hooks.
	RegisterHooks(hookEngine any) error
}

WithHooks is an optional interface for plugins that register hooks.

type WithMigrations

type WithMigrations interface {
	Plugin
	// MigrationGroup returns the plugin's migration group.
	MigrationGroup() any
}

WithMigrations is an optional interface for plugins that provide migrations.

Jump to

Keyboard shortcuts

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