templateprovider

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JinjaTemplate

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

func NewJinjaTemplate

func NewJinjaTemplate(_ string) *JinjaTemplate

func (*JinjaTemplate) Execute

func (t *JinjaTemplate) Execute(fp io.Writer, withVariables map[string]interface{}) error

func (*JinjaTemplate) FromFile

func (t *JinjaTemplate) FromFile(templateFilePath string) error

func (*JinjaTemplate) FromString

func (t *JinjaTemplate) FromString(templateContent string) error

func (*JinjaTemplate) IsMissingKeyError

func (t *JinjaTemplate) IsMissingKeyError(err error) bool

func (*JinjaTemplate) WithErrorOnMissingKey

func (t *JinjaTemplate) WithErrorOnMissingKey(_ bool)

type SprigTemplate

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

func NewSprigTemplate

func NewSprigTemplate(name string) *SprigTemplate

func (*SprigTemplate) Execute

func (t *SprigTemplate) Execute(fp io.Writer, withVariables map[string]interface{}) error

func (*SprigTemplate) FromFile

func (t *SprigTemplate) FromFile(templateFilePath string) error

func (*SprigTemplate) FromString

func (t *SprigTemplate) FromString(templateContent string) error

func (*SprigTemplate) IsMissingKeyError

func (t *SprigTemplate) IsMissingKeyError(err error) bool

func (*SprigTemplate) WithErrorOnMissingKey

func (t *SprigTemplate) WithErrorOnMissingKey(state bool)

type TemplateService

type TemplateService interface {
	// FromFile Load template from file
	FromFile(path string) error
	// FromString Load template from string
	FromString(templateContent string) error
	// Execute Execute the template
	Execute(fp io.Writer, withVariables map[string]interface{}) error
	// WithErrorOnMissingKey Set error on missing key
	WithErrorOnMissingKey(key bool)
	IsMissingKeyError(err error) bool
}

func ByType

func ByType(templateType TemplateType, name string) TemplateService

type TemplateType

type TemplateType int
const (
	SprigTemplateType TemplateType = iota
	JinjaTemplateType
)

func GetTypeFromString

func GetTypeFromString(templateType string) TemplateType

Jump to

Keyboard shortcuts

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