templating package - github.com/belastingdienst/opr-paas/v3/pkg/templating - Go Packages

templating

package
v3.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaasUnion

type PaasUnion interface {
	v1alpha1.Paas | v1alpha2.Paas
}

PaasUnion is an interface representing either a v1alpha1.Paas or a v1alpha2.Paas

type Templater

type Templater[P PaasUnion, C api.PaasConfig[S], S any] struct {
	Paas   P
	Config C
}

Templater is a struct that can hold a Paas and a PaasConfig and can run go-templates using these as input

func NewTemplater

func NewTemplater[P PaasUnion, C api.PaasConfig[S], S any](paas P, config C) Templater[P, C, S]

NewTemplater returns an initialized Templater from a Paas and PaasConfig

func (Templater[P, C, S]) TemplateToMap

func (t Templater[P, C, S]) TemplateToMap(name string, templatedText string) (fields.ElementMap, error)

TemplateToMap can be used to parse a go-template and try to parse as map or list. If it can be parsed, it will prefix map keys / list indexes by `name` and return the map. If it cannot be parsed as map / list, it will return a map with one key, value pair, where key = `name` and value is the result.

func (Templater[P, C, S]) TemplateToString

func (t Templater[P, C, S]) TemplateToString(name string, templatedText string) (string, error)

TemplateToString can be used to parse a go-template and return a string value

func (Templater[P, C, S]) Verify

func (t Templater[P, C, S]) Verify(name string, templatedText string) error

Verify can verify a template (just parsing it, not running it against a Paas / PaasConfig)

Jump to

Keyboard shortcuts

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