wrap

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPrefix = errors.New("prefix does not match the regular expression ^[a-z]+$")

Functions

func SplitPrefix

func SplitPrefix(input string) (prefix string, rest string)

SplitPrefix splits the given input and returns the prefix and rest. If the first character is a minus sign ("-") then everything that follows up to the next whitespace ("\s") is considered to be the prefix and everything following that whitespace is considered to be the rest If the first character is no minus sign, the prefix is empty and the rest equals the input. If input is the empty string or just the minus sign, prefix and rest are empty strings.

Types

type ErrMapperAlreadyExists

type ErrMapperAlreadyExists string

func (ErrMapperAlreadyExists) Error

func (me ErrMapperAlreadyExists) Error() string

type Option

type Option func(*wrap)

func TrimPrefix

func TrimPrefix() Option

type Wrapper

type Wrapper interface {
	places.Replacer

	// Add registers a mapper in the registry for the given key
	Add(key string, m places.Replacer) error

	// Wrap wraps the outer mapping around the inner replacer
	Wrap(inner places.Replacer) places.Replacer
}

Wrapper is a registry of places.Mappers and can wrap a mapper by escaping values

func New

func New(opts ...Option) Wrapper

New returns a new Map that is not safe for concurrent use.

func NewConcurrent

func NewConcurrent(opts ...Option) Wrapper

NewConcurrent returns a new Map that is safe for concurrent use.

Jump to

Keyboard shortcuts

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