engine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFoundNodes = errors.New("no nodes found")

Functions

This section is empty.

Types

type ActionType

type ActionType string

ActionType 定义操作类型

const (
	ActionReplace      ActionType = "replace"
	ActionDelete       ActionType = "delete"
	ActionRegexReplace ActionType = "regex_replace"
)

type Engine

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

Engine 执行 YAML 修改操作

func NewEngine

func NewEngine() *Engine

func (*Engine) Apply

func (e *Engine) Apply(root *yaml.Node, rule *Rule) error

Apply 应用规则到 YAML 文档

type Rule

type Rule struct {
	Action             ActionType  `yaml:"action"`
	Path               string      `yaml:"path"`
	Value              interface{} `yaml:"value,omitempty"`
	Pattern            string      `yaml:"pattern,omitempty"`               // 用于 regex_replace
	ContinueOnNotFound bool        `yaml:"continue_on_not_found,omitempty"` // 找不到节点时是否继续
}

Rule 表示一条修改规则

Jump to

Keyboard shortcuts

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