Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteJSON ¶ added in v0.2.0
ExecuteJSON applies the raw JSON text to the template.
Types ¶
type Data ¶
type Data interface{}
Data is the JSON/YAML will be unmarshaled into this type, then applied to the template.
type Timplit ¶ added in v0.2.0
type Timplit struct { Template io.Reader Data io.Reader Out io.Writer Err io.Writer IgnoreParseErrors bool }
func (*Timplit) JSON ¶ added in v0.2.0
JSON reads a single JSON document from an io.Reader (usually stdin) until EOF, executes the template, and writes the result to an io.Writer (usually stdout). The template is always read first in full, and blocks until EOF is reached.
If t.IgnoreParseErrors is true, then errors will be printed but execution will continue. Otherwise, the first error encountered is returned and subsequent lines will not be read.
func (*Timplit) MultipartJSON ¶ added in v0.2.0
MultipartJSON reads one JSON document per line from an io.Reader (usually stdin), executes the template for each line, and writes the result to an io.Writer (usually stdout). The template is always read first in full, and blocks until EOF is reached.
If t.IgnoreParseErrors is true, then errors will be printed but execution will continue. Otherwise, the first error encountered is returned and subsequent lines will not be read.
func (*Timplit) YAML ¶ added in v0.2.0
YAML executes the template for each YAML document (separated by "---") it reads from an io.Reader (usually stdin) and writes the result to an io.Writer (usually stdout). The template is always read first in full, and blocks until EOF is reached.
If t.IgnoreParseErrors is true, then errors will be printed but execution will continue. Otherwise, the first error encountered is returned and subsequent lines will not be read.