template

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package template provides an interface for text templates to be used during pipes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]interface{}

Fields is a heterogenous map type keyed by strings.

type Template

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

Template is used to apply text templates to strings to dynamically configure API values. See the documentation of text/template to see the valid template format.

func New

func New(ctx *context.Context) *Template

New returns a new template instance.

func (*Template) Apply

func (t *Template) Apply(s string) (string, error)

Apply takes the template string and processes it into its product string.

func (*Template) WithEnv

func (t *Template) WithEnv(env map[string]string) *Template

WithEnv replaces the configured env of the template with the given key-value map.

func (*Template) WithFields

func (t *Template) WithFields(fields Fields) *Template

WithFields merges the template's configured fields with the given Fields.

func (*Template) WithShellEnv

func (t *Template) WithShellEnv(envs ...string) *Template

WithShellEnv replaces the configured env of the template with the given sequence of shell-style, e.g. "KEY=VALUE", strings.

Jump to

Keyboard shortcuts

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