transformer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInitialize = errors.New("non initializable")
View Source
var ErrRegexParse = errors.New("regex parse error")

Functions

This section is empty.

Types

type NamedRegexp

type NamedRegexp struct {
	Plain string
	*regexp.Regexp
}

NamedRegexp is a regexp type but has extra functions to find the named matching substrings

func (*NamedRegexp) FindStringSubmatchMap

func (r *NamedRegexp) FindStringSubmatchMap(s string) map[string]string

FindStringSubmatchMap returns the map{name: foundString} from regexp

type NamedRegexpTransformer

type NamedRegexpTransformer struct {
	Name string
	From NamedRegexp
	To   string
}

func NewNamedRegexpTransformer

func NewNamedRegexpTransformer(name string, from string, to string) (NamedRegexpTransformer, error)

func (NamedRegexpTransformer) Transform

func (t NamedRegexpTransformer) Transform(path string) (string, bool)

type NilTransformer

type NilTransformer struct {
}

func NewNilTransformer

func NewNilTransformer() NilTransformer

func (NilTransformer) Transform

func (t NilTransformer) Transform(path string) (string, bool)

type Pack

type Pack []Transformer

func DefaultPack

func DefaultPack() (Pack, error)

func (Pack) Transform

func (p Pack) Transform(path string) (string, bool)

type Transformer

type Transformer interface {
	Transform(path string) (string, bool)
}

Jump to

Keyboard shortcuts

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