Documentation
¶
Overview ¶
Package conflate provides general-purpose string parsing, transformation, and template merging. It extracts named capture groups from a regexp, applies caller-supplied transforms, and merges the results into a text/template.
The three functions — Parse, Transform, Merge — are independently useful and designed to be composed by the caller.
Index ¶
- func Merge(format string, data map[string]string) (string, error)
- func MergeTemplate(tmpl *template.Template, data map[string]string) (string, error)
- func Parse(pattern, input string) (map[string]string, error)
- func ParseRegexp(exp *regexp.Regexp, input string) (map[string]string, error)
- func Transform(groups map[string]string, transformers map[string]TransformFunc) (map[string]string, error)
- type TransformFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Merge ¶
Merge compiles format into a template and then calls MergeTemplate with it and data.
func MergeTemplate ¶
MergeTemplate executes tmpl against data and returns the result string.
func Parse ¶
Parse compiles pattern into a regular expression and then calls ParseRegexp with it and input.
func ParseRegexp ¶
ParseRegexp extracts named capture groups from input using exp. Returns raw (untransformed) string values keyed by group name. An error is returned if input does not match exp.
Types ¶
type TransformFunc ¶
TransformFunc converts a single captured field value.