replacer

package
v0.0.140 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceTypeRegexp = "regexp"
	SourceTypeString = "string"
)

Variables

This section is empty.

Functions

func ApplyRule

func ApplyRule(before string, rule ReplaceRule) (after string, err error)

func ApplyRules

func ApplyRules(before string, rules *Rules) (after string, err error)

Types

type Data

type Data []ReplaceData

func ReplaceAll

func ReplaceAll(data *Data, rules *Rules) (*Data, error)

type ReplaceData

type ReplaceData struct {
	ID     int64
	Before string
	After  string
}

type ReplaceRule

type ReplaceRule struct {
	// nolint: tagliatelle
	SourceType string `json:"SourceType"`
	// nolint: tagliatelle
	Source string `json:"Source"`
	// nolint: tagliatelle
	Replacement string `json:"Replacement"`
	// contains filtered or unexported fields
}

func (*ReplaceRule) Compile

func (rr *ReplaceRule) Compile()

type Rules

type Rules []ReplaceRule

Jump to

Keyboard shortcuts

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