template

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Configs    map[string]string
	Service    service.TemplateService
	Services   Services
	Parameters Parameters
}

type Maker

type Maker interface {
	Make(
		service service.TemplateService,
		services Services,
		serverTemplates templates.Templates,
	) Template
}

func CreateMaker

func CreateMaker(fnd app.Foundation) Maker

type Parameter

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

Parameter is used to encapsulate values and provide a ToString method.

func NewParameter

func NewParameter(param parameter.Parameter, params parameters.Parameters, tmpl Template) *Parameter

func (*Parameter) IsNumber

func (p *Parameter) IsNumber() bool

func (*Parameter) IsObject

func (p *Parameter) IsObject() bool

func (*Parameter) ToNumber

func (p *Parameter) ToNumber() float64

func (*Parameter) ToObject

func (p *Parameter) ToObject() Parameters

func (*Parameter) ToString

func (p *Parameter) ToString() (string, error)

type Parameters

type Parameters map[string]*Parameter

func NewParameters

func NewParameters(origParams parameters.Parameters, tmpl Template) Parameters

func (Parameters) GetObject

func (p Parameters) GetObject(key string) Parameters

GetObject retrieves a map as a dynamic object with `ToString` method for each value.

func (Parameters) GetObjectString

func (p Parameters) GetObjectString(firstKey, secondKey string) (string, error)

GetObjectString retrieves a string value by the secondKey of the object retrieved by the firstKey

func (Parameters) GetString

func (p Parameters) GetString(key string) (string, error)

GetString retrieves a string value directly from the parameters.

type Services

type Services map[string]service.TemplateService

func (Services) Find

func (svcs Services) Find(name string) (service.TemplateService, error)

type Template

type Template interface {
	RenderToWriter(content string, parameters parameters.Parameters, writer io.Writer) error
	RenderToFile(content string, parameters parameters.Parameters, filePath string, perm os.FileMode) error
	RenderToString(content string, parameters parameters.Parameters) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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