panylexpr

package module
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: MIT Imports: 12 Imported by: 0

README

panyl-expr

Author

Rangel Reale (rangelreale@gmail.com)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Plugin *Plugin
	When   *vm.Program
	Do     *vm.Program
}

func NewCondition

func NewCondition(plugin *Plugin, when, do string) (Condition, error)

func (Condition) Process

func (e Condition) Process(ctx context.Context, item *panyl.Item) error

type ConditionConfig

type ConditionConfig struct {
	Conditions []ConditionItemConfig `yaml:"conditions"`
}

type ConditionItemConfig

type ConditionItemConfig struct {
	When string `yaml:"when"`
	Do   string `yaml:"do"`
}

type Option added in v2.1.1

type Option func(*Plugin) error

func WithConfigFile

func WithConfigFile(filename string) Option

WithConfigFile sets a filename to read the configuration file.

func WithConfigReader

func WithConfigReader(r io.Reader) Option

WithConfigReader sets an io.Reader to read the configuration file.

func WithConstants added in v2.1.1

func WithConstants(constants map[string]any) Option

WithConstants adds extra constants to the scripts.

func WithLogger added in v2.1.1

func WithLogger(logger *slog.Logger) Option

WithLogger sets a logger for debugging purposes.

type Plugin added in v2.1.1

type Plugin struct {
	Logger     *slog.Logger
	Conditions []Condition
	Constants  map[string]any
}

func New

func New(options ...Option) (*Plugin, error)

func (*Plugin) AddConstants added in v2.1.1

func (p *Plugin) AddConstants(c map[string]any)

func (*Plugin) IsPanylPlugin added in v2.1.1

func (p *Plugin) IsPanylPlugin()

func (*Plugin) PostProcess added in v2.1.1

func (p *Plugin) PostProcess(ctx context.Context, item *panyl.Item) (bool, error)

func (*Plugin) PostProcessOrder added in v2.1.1

func (p *Plugin) PostProcessOrder() int

Jump to

Keyboard shortcuts

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