fastvars

package module
v0.0.0-...-62bc88e Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2016 License: MIT Imports: 4 Imported by: 0

README

fastvars

GoDoc

fastvars is fasttemplate wrapper with dictionary substitusion ability.

Usage

fv, err := NewFastVars()
if err != nil {
    log.Fatal("NewFastVars() failed")
}
fv.Append(map[string]interface{}{
	"IP":   "127.0.0.1",
	"PORT": 80,
	"URL":  "http://#{IP}:#{PORT}/",
})
fmt.Println(fv.Get("URL"))
//returns http://127.0.0.1:80/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FastVars

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

FastVars map

func NewFastVars

func NewFastVars() (FastVars, error)

NewFastVars create default FastVars map

func NewFastVarsDict

func NewFastVarsDict(vars map[string]interface{}) (FastVars, error)

NewFastVarsDict create FastVars initialize it with given map

func (*FastVars) Append

func (fv *FastVars) Append(vars map[string]interface{})

Append add vars to fv.variables map

func (*FastVars) Get

func (fv *FastVars) Get(key string) (interface{}, error)

Get returns value by key

func (*FastVars) Process

func (fv *FastVars) Process(tpl string) (string, error)

Process transform given template

Jump to

Keyboard shortcuts

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