tmpl

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package tmpl renders Go and mustache templates that generate random values for every execution. It is used by yo to build requests whose URL, headers and body vary from call to call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(raw []byte) bool

Contains reports whether raw contains template syntax.

func Render

func Render(raw []byte) ([]byte, error)

Render parses and renders raw in a single call.

func RenderString

func RenderString(s string) (string, error)

RenderString parses and renders s in a single call.

func SetValues

func SetValues(v Vars)

SetValues sets the named value lists available to templates through the {{var "name"}} helper. It is safe to call before parsing templates.

Types

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template is a compiled yo template. Rendering it produces a fresh random document. Non-template inputs are rendered verbatim.

func Parse

func Parse(raw []byte) (*Template, error)

Parse compiles raw, auto-detecting mustache and Go template syntax.

func (*Template) Render

func (t *Template) Render() ([]byte, error)

Render executes the template and returns a fresh random document.

func (*Template) RenderString

func (t *Template) RenderString() (string, error)

RenderString is a convenience wrapper around Render.

type Vars

type Vars map[string][]string

Vars maps a name to the list of values {{var "name"}} picks from.

Jump to

Keyboard shortcuts

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