Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Brain ¶
Brain is what Template uses to determine the values that are available for template parsing.
func NewBrain ¶
func NewBrain() *Brain
NewBrain creates a new Brain with empty values for each of the key structs.
func (*Brain) ForceSet ¶
ForceSet is used to force set the value of a dependency for a given hash code
func (*Brain) Forget ¶
func (b *Brain) Forget(d dep.Dependency)
Forget accepts a dependency and removes all associated data with this dependency. It also resets the "receivedData" internal map.
func (*Brain) Recall ¶
func (b *Brain) Recall(d dep.Dependency) (interface{}, bool)
Recall gets the current value for the given dependency in the Brain.
func (*Brain) Remember ¶
func (b *Brain) Remember(d dep.Dependency, data interface{})
Remember accepts a dependency and the data to store associated with that dep. This function converts the given data to a proper type and stores it interally.
type Template ¶
type Template struct { // Path is the path to this template on disk. Path string // LeftDelim and RightDelim are the left and right delimiters to use. LeftDelim, RightDelim string // Contents is the string contents for the template. It is either given // during template creation or read from disk when initialized. Contents string // HexMD5 stores the hex version of the MD5 HexMD5 string }
func NewTemplate ¶
NewTemplate creates and parses a new Consul Template template at the given path. If the template does not exist, an error is returned. During initialization, the template is read and is parsed for dependencies. Any errors that occur are returned.
func (*Template) Execute ¶
func (t *Template) Execute(brain *Brain) ([]dep.Dependency, []dep.Dependency, []byte, error)
Execute evaluates this template in the context of the given brain.
The first return value is the list of used dependencies. The second return value is the list of missing dependencies. The third return value is the rendered text. The fourth return value any error that occurs.