plugin

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 12 Imported by: ? 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

Index

Constants

This section is empty.

Variables

View Source
var ErrPluginNotFound = errors.New("plugin not found")

Functions

This section is empty.

Types

type AdminProvider

type AdminProvider interface {
	AdminResources() []AdminResource
}

type AdminResource

type AdminResource struct {
	Name        string
	Title       string
	Description string
	Model       any
	Permissions []string
}

type App

type App interface{}

type Configurable

type Configurable interface {
	DefaultSettings() map[string]any
}

type Entry

type Entry struct {
	Plugin         Plugin
	Manifest       Manifest
	Enabled        bool
	Settings       map[string]any
	SettingsSchema SettingsSchema
	AdminResources []AdminResource
	Migrations     []Migration
	// contains filtered or unexported fields
}

type FileMigrationStore

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

func NewFileMigrationStore

func NewFileMigrationStore(path string) *FileMigrationStore

func (*FileMigrationStore) IsApplied

func (s *FileMigrationStore) IsApplied(ctx context.Context, namespace, migrationID string) (bool, error)

func (*FileMigrationStore) ListApplied

func (s *FileMigrationStore) ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)

func (*FileMigrationStore) MarkApplied

func (s *FileMigrationStore) MarkApplied(ctx context.Context, namespace, migrationID string, appliedAt time.Time) error

func (*FileMigrationStore) UnmarkApplied

func (s *FileMigrationStore) UnmarkApplied(ctx context.Context, namespace, migrationID string) error

type FileSettingsStore

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

func NewFileSettingsStore

func NewFileSettingsStore(path string) *FileSettingsStore

func (*FileSettingsStore) Load

func (s *FileSettingsStore) Load(ctx context.Context, pluginName string) (map[string]any, error)

func (*FileSettingsStore) Save

func (s *FileSettingsStore) Save(ctx context.Context, pluginName string, settings map[string]any) error

type Manifest

type Manifest struct {
	Name        string
	Version     string
	Description string
	Author      string
}

type ManifestProvider

type ManifestProvider interface {
	Manifest() Manifest
}

type MemoryMigrationStore

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

func NewMemoryMigrationStore

func NewMemoryMigrationStore() *MemoryMigrationStore

func (*MemoryMigrationStore) IsApplied

func (s *MemoryMigrationStore) IsApplied(ctx context.Context, pluginName, migrationID string) (bool, error)

func (*MemoryMigrationStore) ListApplied

func (s *MemoryMigrationStore) ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)

func (*MemoryMigrationStore) MarkApplied

func (s *MemoryMigrationStore) MarkApplied(ctx context.Context, pluginName, migrationID string, appliedAt time.Time) error

func (*MemoryMigrationStore) UnmarkApplied

func (s *MemoryMigrationStore) UnmarkApplied(ctx context.Context, pluginName, migrationID string) error

type Migratable

type Migratable interface {
	Migrations() []Migration
}

type Migration

type Migration struct {
	ID   string
	Name string
	Up   func(ctx context.Context) error
	Down func(ctx context.Context) error
}

type MigrationReport

type MigrationReport struct {
	Applied int
	Skipped int
}

type MigrationStateInspector

type MigrationStateInspector interface {
	ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)
}

type MigrationStateMutator

type MigrationStateMutator interface {
	UnmarkApplied(ctx context.Context, namespace, migrationID string) error
}

type MigrationStateStore

type MigrationStateStore interface {
	IsApplied(ctx context.Context, pluginName, migrationID string) (bool, error)
	MarkApplied(ctx context.Context, pluginName, migrationID string, appliedAt time.Time) error
}

type Plugin

type Plugin interface {
	Name() string
	Version() string
	Init(app App) error
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Active

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

func (*Registry) AdminResources

func (r *Registry) AdminResources(name string) ([]AdminResource, bool)

func (*Registry) All

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

func (*Registry) ApplyMigrations

func (r *Registry) ApplyMigrations(ctx context.Context, store MigrationStateStore) (MigrationReport, error)

func (*Registry) Disable

func (r *Registry) Disable(name string) error

func (*Registry) Enable

func (r *Registry) Enable(name string) error

func (*Registry) Entries

func (r *Registry) Entries() []Entry

func (*Registry) LoadSettings

func (r *Registry) LoadSettings(ctx context.Context) error

func (*Registry) Manifests

func (r *Registry) Manifests() []Manifest

func (*Registry) Register

func (r *Registry) Register(p Plugin) error

func (*Registry) SetSetting

func (r *Registry) SetSetting(name, key string, value any) error

func (*Registry) SetSettingsStore

func (r *Registry) SetSettingsStore(store SettingsStateStore)

func (*Registry) Setting

func (r *Registry) Setting(name, key string) (any, bool)

func (*Registry) Settings

func (r *Registry) Settings(name string) (map[string]any, bool)

func (*Registry) SettingsSchema

func (r *Registry) SettingsSchema(name string) (SettingsSchema, bool)

func (*Registry) UpdateSettings

func (r *Registry) UpdateSettings(name string, updates map[string]any) error

type SessionMigrationStore

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

func NewSessionMigrationStore

func NewSessionMigrationStore(repo storage.SessionRepository) *SessionMigrationStore

func (*SessionMigrationStore) IsApplied

func (s *SessionMigrationStore) IsApplied(ctx context.Context, pluginName, migrationID string) (bool, error)

func (*SessionMigrationStore) ListApplied

func (s *SessionMigrationStore) ListApplied(ctx context.Context, namespace string) (map[string]time.Time, error)

func (*SessionMigrationStore) MarkApplied

func (s *SessionMigrationStore) MarkApplied(ctx context.Context, pluginName, migrationID string, appliedAt time.Time) error

func (*SessionMigrationStore) UnmarkApplied

func (s *SessionMigrationStore) UnmarkApplied(ctx context.Context, pluginName, migrationID string) error

type SessionSettingsStore

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

func NewSessionSettingsStore

func NewSessionSettingsStore(repo storage.SessionRepository) *SessionSettingsStore

func (*SessionSettingsStore) Load

func (s *SessionSettingsStore) Load(ctx context.Context, pluginName string) (map[string]any, error)

func (*SessionSettingsStore) Save

func (s *SessionSettingsStore) Save(ctx context.Context, pluginName string, settings map[string]any) error

type SettingField

type SettingField struct {
	Key         string
	Type        string
	Title       string
	Description string
	Default     any
	Required    bool
}

type SettingsSchema

type SettingsSchema struct {
	Fields []SettingField
}

type SettingsSchemaProvider

type SettingsSchemaProvider interface {
	SettingsSchema() SettingsSchema
}

type SettingsStateStore

type SettingsStateStore interface {
	Load(ctx context.Context, pluginName string) (map[string]any, error)
	Save(ctx context.Context, pluginName string, settings map[string]any) error
}

Jump to

Keyboard shortcuts

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