tdata

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tdata implements TemplateData from which data can be used to replace templates from other Stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithStores

func WithStores(stores ...store.Store) option

WithStores sets Stores from which data is read into TemplateData

Types

type TemplateData

type TemplateData interface {
	Replace(tpl []byte) ([]byte, error) // use data from TemplateData to replace templates in `tpl`
}

TemplateData provides data for replacing templates

func New

func New(opts ...option) (TemplateData, error)

New creates a TemplateData object which supports the following user-defined functions:

  • env KEY replace `env KEY` with the value of `KEY` read from ENV
  • hostname replace `hostname` with the value of os.Hostname()
  • value KEY replace `value KEY` with the value of `KEY` read from Stores assigned to the TemplateData object

Jump to

Keyboard shortcuts

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