Documentation
¶
Index ¶
- Constants
- func MergeVariableMap(mapin map[string]interface{}, maporigin map[string]interface{}) (map[string]interface{}, error)
- func MergeVariableMapRef(mapin map[string]interface{}, maporigin *map[string]interface{}) error
- type CtxTemplate
- func (c *CtxTemplate) AddDataMap(m map[string]interface{})
- func (c *CtxTemplate) AddDataValue(key string, value interface{})
- func (c *CtxTemplate) ParseTemplate(tmpl *template.Template) (string, error)
- func (c *CtxTemplate) ParseTemplateString(tmpl string) (string, error)
- func (c *CtxTemplate) SetData(data map[string]interface{})
- func (c *CtxTemplate) SetLogger(logger mimiclog.Logger)
- type IgnoreSet
- type IgnoreSetMap
- type IgnorreHndl
- type Template
- func (t *Template) FindIncludeFileName(path string) (string, bool)
- func (t *Template) FindTemplateFileName() (string, bool)
- func (t *Template) GetIncludeConfig() *configure.IncludePaths
- func (t *Template) GetIncludeFile() string
- func (t *Template) GetLinter() (*yaclint.Linter, error)
- func (t *Template) GetOriginMap() map[string]interface{}
- func (t *Template) HandleContxtTemplate(path string) (string, error)
- func (t *Template) ImportFolder(startPath string) (map[string]interface{}, error)
- func (t *Template) Init() error
- func (t *Template) Load() (configure.RunConfig, bool, error)
- func (t *Template) LoadInclude(path string) (configure.IncludePaths, bool, error)
- func (t *Template) LoadV2() (configure.RunConfig, error)
- func (t *Template) LoadV2ByAbsolutePath(absolutePath string) (configure.RunConfig, error)
- func (t *Template) ParseGoTemplate(data string) (string, error)
- func (t *Template) ReadValueFiles(startPath string, resultMap *map[string]interface{}) error
- func (t *Template) SetIgnoreHndl(onoff bool)
- func (t *Template) SetIncludeFile(file string)
- func (t *Template) SetLinting(linting bool)
- func (t *Template) SetLogger(logger mimiclog.Logger)
- func (t *Template) SetOnLoad(fn func(*configure.RunConfig) error)
- func (t *Template) TryHandleTemplate(path string) (string, error)
- func (t *Template) UpdateOriginMap(mapData map[string]interface{})
Constants ¶
const ( DefaultTemplateFile = ".contxt.yml" DefaultIncludeFile = ".inc.contxt.yml" DefaultIgnoreFile = ".tpl.ignore" )
Variables ¶
This section is empty.
Functions ¶
func MergeVariableMap ¶
func MergeVariableMap(mapin map[string]interface{}, maporigin map[string]interface{}) (map[string]interface{}, error)
MergeVariableMap merges two maps this is a global function that is used in different places
func MergeVariableMapRef ¶
Types ¶
type CtxTemplate ¶
type CtxTemplate struct {
// contains filtered or unexported fields
}
func NewCtxTemplate ¶
func NewCtxTemplate() *CtxTemplate
func (*CtxTemplate) AddDataMap ¶
func (c *CtxTemplate) AddDataMap(m map[string]interface{})
func (*CtxTemplate) AddDataValue ¶
func (c *CtxTemplate) AddDataValue(key string, value interface{})
func (*CtxTemplate) ParseTemplate ¶
func (c *CtxTemplate) ParseTemplate(tmpl *template.Template) (string, error)
func (*CtxTemplate) ParseTemplateString ¶
func (c *CtxTemplate) ParseTemplateString(tmpl string) (string, error)
func (*CtxTemplate) SetData ¶
func (c *CtxTemplate) SetData(data map[string]interface{})
func (*CtxTemplate) SetLogger ¶
func (c *CtxTemplate) SetLogger(logger mimiclog.Logger)
type IgnoreSet ¶
type IgnoreSet struct {
// contains filtered or unexported fields
}
func NewIgnoreSet ¶
type IgnoreSetMap ¶
func NewIgnoreSetMap ¶
func NewIgnoreSetMap() IgnoreSetMap
func (IgnoreSetMap) Add ¶
func (i IgnoreSetMap) Add(origin string)
type IgnorreHndl ¶
type IgnorreHndl struct {
// contains filtered or unexported fields
}
func NewIgnorreHndl ¶
func NewIgnorreHndl(origin string) *IgnorreHndl
func (*IgnorreHndl) AddIgnores ¶
func (i *IgnorreHndl) AddIgnores(stringToIgnore ...string)
func (*IgnorreHndl) CreateMaskedString ¶
func (i *IgnorreHndl) CreateMaskedString() string
func (*IgnorreHndl) RestoreOriginalString ¶
func (i *IgnorreHndl) RestoreOriginalString(useThisString string) string
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func (*Template) FindIncludeFileName ¶
FindIncludeFileName returns the full path to the include file if it exists the bool value indicates if the file exists or not the default include file name is .inc.contxt.yml in the current directory
func (*Template) FindTemplateFileName ¶
FindTemplateFileName searchs for Template files in the current directory the bool value indicates if the file exists or not the default template file name is .contxt.yml in the current directory
func (*Template) GetIncludeConfig ¶
func (t *Template) GetIncludeConfig() *configure.IncludePaths
func (*Template) GetIncludeFile ¶
func (*Template) GetOriginMap ¶
func (*Template) HandleContxtTemplate ¶
HandleContxtTemplate parses a template file and returns the parsed content by using all the the include files. the usage is the same as the go template parser. so you can use {{ .var }} to access the variables in this case it is expected, we have a .inc.contxt.yml file in the same directory, that defines the include files. if no include file is found, the template file will be parsed as go/template these definition is required, because all these files containing the values, they are used for parsing by using go/template
func (*Template) ImportFolder ¶
func (*Template) Init ¶
Init initializes the Template struct this is ment to be called before any other function
func (*Template) Load ¶
Load loads the template file and returns the parsed content. this is ment for loading the default template file. so anything here is depending the default template file name, and the current directory.
func (*Template) LoadInclude ¶
LoadInclude loads the include files and returns the parsed content. these files are defined in the default include file named .inc.contxt.yml any of these files can have template placeholders, they will processed
func (*Template) LoadV2 ¶
LoadV2 loads the template file and returns the parsed content. this is ment for loading the default template file. if you like to load a template file from a different location use LoadV2ByAbsolutePath
func (*Template) LoadV2ByAbsolutePath ¶
LoadV2ByAbsolutePath loads the template file and returns the parsed content. this is ment for loading a template file from a different location.
func (*Template) ReadValueFiles ¶
func (*Template) SetIgnoreHndl ¶
func (*Template) SetIncludeFile ¶
func (*Template) SetLinting ¶
SetLinting enables or disables the linting process
func (*Template) SetOnLoad ¶
set the callback function that is called after the template file is loaded
func (*Template) TryHandleTemplate ¶
Different to HandleContxtTemplate, here we do not expect the include definition file .inc.contxt.yml. We just try to parse the template file togehter with the current data map