plugin

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 1 Imported by: 16

Documentation

Index

Constants

View Source
const (
	ConfigKeyDependencies = "__dependencies"
	ConfigKeyVersion      = "__version"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Command added in v0.3.2

type Command interface {
	Name() string
	Description() string
	Run(ctx *CommandContext) *CommandResult
}

type CommandContext added in v0.3.2

type CommandContext struct {
	Config any

	Args []string

	ProgressCallback func(message string)
}

type CommandProvider added in v0.3.2

type CommandProvider interface {
	Commands() []Command
}

type CommandResult added in v0.3.2

type CommandResult struct {
	Success bool

	Error error

	FilesCreated []string

	FilesModified []string

	Message string
}

type EndpointSetup

type EndpointSetup interface {
	SetupEndpoints(router fiber.Router) error
}

type MigrationProvider added in v0.4.0

type MigrationProvider interface {
	// MigrationSource returns a migration source for this plugin
	// The source name should match the plugin name
	// Returns any to avoid circular dependency with migrations package
	// Actual type should be migrations.MigrationSource
	MigrationSource() any

	// MigrationDependencies returns list of sources this plugin depends on
	// Example: ["app", "users-plugin"]
	// Ensures migrations run in correct order
	// Return nil or empty slice if no dependencies
	MigrationDependencies() []string
}

type OpenAPIProvider added in v0.4.8

type OpenAPIProvider interface {
	GetOpenAPIResources() []OpenAPIResource
}

type OpenAPIResource added in v0.4.8

type OpenAPIResource struct {
	Name          string
	PluralName    string
	BasePath      string
	Tags          []string
	ResponseModel any
	CreateModel   any
	UpdateModel   any
	Description   string
}

type Plugin

type Plugin interface {
	Name() string

	Initialize(config map[string]any) error

	Handler() fiber.Handler
}

type PluginDependencies added in v0.4.5

type PluginDependencies interface {
	Dependencies() []string
}

PluginDependencies is an optional interface for plugins that depend on other plugins. Dependencies must be declared by their plugin name (matching Plugin.Name()). The plugin loader ensures:

  • All dependencies are registered and enabled
  • Dependencies are initialized before dependent plugins
  • Circular dependencies are detected and rejected
  • Dependencies are injected via Initialize() config under ConfigKeyDependencies

type PluginRegistry

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

Plugins are NOT automatically applied; user must explicitly call plugin.Handler() and register it.

func NewPluginRegistry

func NewPluginRegistry() *PluginRegistry

func (*PluginRegistry) Get

func (r *PluginRegistry) Get(name string) (Plugin, bool)

func (*PluginRegistry) GetAll

func (r *PluginRegistry) GetAll() map[string]Plugin

func (*PluginRegistry) Register

func (r *PluginRegistry) Register(plugin Plugin)

Jump to

Keyboard shortcuts

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