plugin

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 3 Imported by: 0 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 (
	ErrHookNotFound          = errors.New("hook not found")
	ErrHookExecutionFailed   = errors.New("hook execution failed")
	ErrHookAlreadyRegistered = errors.New("hook already registered")
)
View Source
var (
	ErrPluginNotFound      = errors.New("plugin not found")
	ErrPluginInvalidFormat = errors.New("invalid WASM format")
	ErrPluginLoadFailed    = errors.New("plugin load failed")
)

Functions

This section is empty.

Types

type FailureMode

type FailureMode int
const (
	FailFast FailureMode = iota
	LogAndContinue
	Fallback

	DefaultFailureMode FailureMode = FailFast
)

func ParseFailureMode

func ParseFailureMode(s string) FailureMode

func (FailureMode) String

func (f FailureMode) String() string

type HookHandler

type HookHandler func(ctx context.Context, data []byte) ([]byte, error)

type HookName

type HookName string
const (
	HookBeforeSave     HookName = "BeforeSaveContent"
	HookAfterPublish   HookName = "AfterPublishContent"
	HookBeforeDelete   HookName = "BeforeDeleteContent"
	HookAfterCreate    HookName = "AfterCreateContent"
	HookAfterUnpublish HookName = "AfterUnpublishContent"
	HookOnPluginLoaded HookName = "OnPluginLoaded"

	DefaultPriority = 100
)

func ResolveWasmHookName

func ResolveWasmHookName(exportSuffix string) HookName

func (HookName) String

func (h HookName) String() string

type HookRegistration

type HookRegistration struct {
	PluginName      string
	HookName        HookName
	Priority        int
	Handler         HookHandler
	FailureMode     FailureMode
	FallbackHandler HookHandler
}

type Plugin

type Plugin struct {
	Name     string
	FilePath string
	Status   Status
	LoadedAt time.Time
}

type Status

type Status string
const (
	StatusLoaded   Status = "loaded"
	StatusFailed   Status = "failed"
	StatusUnloaded Status = "unloaded"
)

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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