templates

package
v0.25.0 Latest Latest
Warning

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

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

Documentation

Overview

Package templates holds the Go text/template helper functions shared by stream's templated inputs (e.g. the log command's --template mode) and the http-server mock config. Keeping them in one place ensures a template behaves identically no matter where it is evaluated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Funcs

func Funcs() template.FuncMap

Funcs returns the template function map available to stream templates.

The following functions and their behaviour are documented in the README:

  • env KEY: returns the KEY environment variable.
  • hostname: returns the current hostname.
  • sum A B: returns the sum of two integers.
  • file PATH: returns the contents of the file at PATH.
  • glob PATTERN: returns the names of files matching PATTERN.
  • minify_json: compacts a JSON document onto a single line.
  • now [OFFSET]: returns the current UTC time, optionally offset by a Go duration string (e.g. "-720h" for 30 days ago).

func Render

func Render(s string) ([]byte, error)

Render parses s as a Go text/template using Funcs and executes it with no data, returning the rendered bytes. Missing keys render as their zero value, matching the behaviour of the http-server config templates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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