template

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 24 Imported by: 8

Documentation

Index

Constants

View Source
const (
	DefaultCharset = "[_A-Za-z0-9]"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Ctx    []Ctx
	Functs template.FuncMap
}

func (*Builder) AddCtx

func (b *Builder) AddCtx(ctx Ctx)

func (*Builder) Bool

func (b *Builder) Bool(text string, defaultVal bool) (bool, error)

func (*Builder) BuildFuncMap

func (b *Builder) BuildFuncMap() template.FuncMap

func (*Builder) Float64

func (b *Builder) Float64(text string, defaultVal float64) (float64, error)

func (*Builder) GetTemplate

func (b *Builder) GetTemplate(name, text string) (*template.Template, error)

func (*Builder) Int

func (b *Builder) Int(text string, defaultVal int64) (int64, error)

func (*Builder) NewConfigContext added in v0.9.0

func (b *Builder) NewConfigContext(configGroups []kotsv1beta1.ConfigGroup, templateContext map[string]ItemValue) (*ConfigCtx, error)

func (*Builder) RenderTemplate

func (b *Builder) RenderTemplate(name string, text string) (string, error)

func (*Builder) String

func (b *Builder) String(text string) (string, error)

func (*Builder) Uint

func (b *Builder) Uint(text string, defaultVal uint64) (uint64, error)

type ConfigCtx

type ConfigCtx struct {
	ItemValues map[string]ItemValue
}

func (ConfigCtx) FuncMap

func (ctx ConfigCtx) FuncMap() template.FuncMap

FuncMap represents the available functions in the ConfigCtx.

type Ctx

type Ctx interface {
	FuncMap() template.FuncMap
}

type ItemValue

type ItemValue struct {
	Value   interface{}
	Default interface{}
}

ConfigCtx is the context for builder functions before the application has started.

func (ItemValue) DefaultStr

func (i ItemValue) DefaultStr() string

func (ItemValue) HasDefault

func (i ItemValue) HasDefault() bool

func (ItemValue) HasValue

func (i ItemValue) HasValue() bool

func (ItemValue) ValueStr

func (i ItemValue) ValueStr() string

type StaticCtx

type StaticCtx struct {
}

func (StaticCtx) FuncMap

func (ctx StaticCtx) FuncMap() template.FuncMap

Jump to

Keyboard shortcuts

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