Documentation
¶
Overview ¶
Package internal provides shared helpers for api/rest and api/events. It is not part of the public API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TemplateVarRe = regexp.MustCompile(`\{([^}]+)\}`)
TemplateVarRe matches {varName} placeholders in path or topic templates.
Functions ¶
func BuildFromTemplate ¶
func BuildFromTemplate( template string, vars map[string]string, paramCodecs map[string]codex.Codec[string], wrapMissing func(name string) error, wrapErr func(name, value string, err error) error, ) (string, error)
BuildFromTemplate substitutes {varName} placeholders in template with values from vars, validating each against the corresponding codec in paramCodecs. wrapMissing is called to produce a typed error when a template variable has no entry in vars. wrapErr is called to produce a typed error when codec validation fails.
func ParseTemplateVars ¶
ParseTemplateVars returns the set of variable names (without braces) found in a path or topic template such as "/users/{id}/posts/{postId}".
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.