template

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: GPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadManifestDataAsObject

func LoadManifestDataAsObject(data any, manifestDir string, loader Loader) (pathSpec *util.PathSpec, res any, err error)

func LoadManifestDataAsRawJson

func LoadManifestDataAsRawJson(data any, manifestDir string) (pathSpec *util.PathSpec, res json.RawMessage, err error)

func N

func N(n any) ([]struct{}, error)

N returns a slice of n 0-sized elements, suitable for ranging over. (github.com/bradfitz)

Types

type Loader

type Loader struct {
	HTTPServerHost string
	ServerURL      *url.URL
	OAuthClient    util.OAuthClientsConfig
	Delimiters     delimiters

	// ParallelRunIdx is the index of the Parallel Run that this Loader is used in
	ParallelRunIdx int
	// contains filtered or unexported fields
}

Loader loads and executes a manifest template.

A manifest template is a customized version of Go's text/template, plus custom template functions (which are initialized with the Loader's properties, where applicable).

func NewLoader

func NewLoader(datastore *datastore.Datastore) Loader

func (*Loader) Render

func (loader *Loader) Render(
	tmplBytes []byte,
	rootDir string,
	ctx any) (res []byte, err error)

Render loads and executes a manifest template.

For a description of the manifest template, refer to Loader's docstring.

  • tmplBytes is the manifest template, as loaded from disk.
  • rootDir is the path of the directory in which manifest resides.
  • ctx is the data passed on to the template's Execute function. Contrary to what convention may suggest, it is not a context.Context.

Jump to

Keyboard shortcuts

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