Documentation ¶
Index ¶
- func NewLoader(env *Envar) loader
- type Context
- func (c *Context) Exists(variableName reflect.Value) reflect.Value
- func (c *Context) FuncMap() template.FuncMap
- func (c *Context) GroupExists(group reflect.Value) bool
- func (c *Context) Item(name reflect.Value, set reflect.Value) reflect.Value
- func (c *Context) ItemEq(name reflect.Value, set reflect.Value, value reflect.Value) reflect.Value
- func (c *Context) ItemNeq(name reflect.Value, set reflect.Value, value reflect.Value) reflect.Value
- func (c *Context) Select(group reflect.Value) reflect.Value
- func (c *Context) Var(name reflect.Value) reflect.Value
- type Envar
- func (e *Envar) Add(key, value string)
- func (e *Envar) Append(v map[string]string) conf.Configuration
- func (e *Envar) Get(key string) string
- func (e *Envar) Group(groupName reflect.Value) reflect.Value
- func (e *Envar) Merge(env conf.Configuration)
- func (e *Envar) MergeMap(env map[string]string)
- func (e *Envar) Replace()
- func (e *Envar) Set(key, value string)
- func (e *Envar) Slice() []string
- func (e *Envar) String() string
- func (e *Envar) Vars() map[string]string
- type Set
- type TemplMerger
- func (t *TemplMerger) Files() map[string][]byte
- func (t *TemplMerger) GetFile(name string) []byte
- func (t *TemplMerger) LoadStringTemplates(templs map[string]string) error
- func (t *TemplMerger) LoadTemplates(files []string) error
- func (t *TemplMerger) LoadTemplatesBytes(files map[string][]byte) error
- func (t *TemplMerger) Merge(env *Envar) error
- func (t *TemplMerger) MergeWithCtx(ctx TemplateContext) (err error)
- func (t *TemplMerger) Save() error
- type TemplateContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct { Env *Envar Loader loader // a list of variable sets Items []Set // contains filtered or unexported fields }
Context the merge context for artisan templates .art
func (*Context) Item ¶
Item return a grouped variable value using its name and the current iteration set
func (*Context) ItemEq ¶
ItemEq return a boolean indicating whether the value of a variable identified by key is equals to the passed-in value
func (*Context) ItemNeq ¶
ItemNeq return a boolean indicating whether the value of a variable identified by key is not equal to the passed-in value
type Envar ¶
type Envar struct {
// contains filtered or unexported fields
}
func NewEnVarEmpty ¶
func NewEnVarEmpty() *Envar
func NewEnVarFromFile ¶
func NewEnVarFromMap ¶
func NewEnVarFromSlice ¶
func NewEnvVarOS ¶
func NewEnvVarOS() *Envar
func (*Envar) Group ¶
Group used by golang text.Template to return a map of key / values for vars that whose base name is the same but have been suffixed with an incremental index number
func (*Envar) Merge ¶
func (e *Envar) Merge(env conf.Configuration)
type Set ¶
type Set struct { Context *Context // a list of values associated with a set name // eg: [ "NAME" ] [ "port a" ] // [ "DESC" ] [ "this is port a" ] // [ "VALUE" ] [ "80" ] Value map[string]string }
Set a group of values for a variable group identified by a group name for a specific index
type TemplMerger ¶
type TemplMerger struct {
// contains filtered or unexported fields
}
TemplMerger merge artisan templates using artisan inputs
func NewTemplMerger ¶
func NewTemplMerger() (*TemplMerger, error)
NewTemplMerger create a new instance of the template merger to merge files
func (*TemplMerger) Files ¶
func (t *TemplMerger) Files() map[string][]byte
func (*TemplMerger) GetFile ¶
func (t *TemplMerger) GetFile(name string) []byte
func (*TemplMerger) LoadStringTemplates ¶
func (t *TemplMerger) LoadStringTemplates(templs map[string]string) error
func (*TemplMerger) LoadTemplates ¶
func (t *TemplMerger) LoadTemplates(files []string) error
LoadTemplates load the template files to use
func (*TemplMerger) LoadTemplatesBytes ¶
func (t *TemplMerger) LoadTemplatesBytes(files map[string][]byte) error
func (*TemplMerger) Merge ¶
func (t *TemplMerger) Merge(env *Envar) error
Merge templates with the passed in environment
func (*TemplMerger) MergeWithCtx ¶
func (t *TemplMerger) MergeWithCtx(ctx TemplateContext) (err error)
MergeWithCtx templates with the passed in merge context
func (*TemplMerger) Save ¶
func (t *TemplMerger) Save() error
type TemplateContext ¶
func NewContext ¶
func NewContext(env *Envar) (TemplateContext, error)