template

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2017 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//FloatNumberPrecision float number precision
	FloatNumberPrecision = 0.0000001
)

Variables

View Source
var ErrEmptySrc = errors.New("empty src template")

Functions

func Base64Decode added in v0.13.7

func Base64Decode(data string) (string, error)

func Base64Encode added in v0.13.7

func Base64Encode(data string) string

func CreateMap added in v0.13.1

func CreateMap(values ...interface{}) (map[string]interface{}, error)

CreateMap creates a key-value map of string -> interface{} The i'th is the key and the i+1 is the value

func DoArithmetic added in v0.13.1

func DoArithmetic(a, b interface{}, op rune) (interface{}, error)

DoArithmetic performs arithmetic operations (+,-,*,/) using reflection to determine the type of the two terms. This func will auto convert string and uint to int64/float64, then apply operations, return float64, or int64

func Filter added in v0.13.2

func Filter(regex string, c interface{}) ([]interface{}, error)

func Getenv added in v0.13.1

func Getenv(key string, v ...string) string

Getenv retrieves the value of the environment variable named by the key. It returns the value, which will the default value if the variable is not present. If no default value was given - returns "".

func LookupIP added in v0.13.1

func LookupIP(data string) []string

func LookupSRV added in v0.13.1

func LookupSRV(service, proto, name string) []*net.SRV

func LookupV4IP added in v0.14.0

func LookupV4IP(data string) []string

func Process added in v0.7.0

func Process(config Config) error

func Reverse added in v0.14.0

func Reverse(values interface{}) interface{}

Reverse returns the array in reversed order works with []string and []KVPair

func Seq added in v0.14.0

func Seq(first, last int) []int

Seq creates a sequence of integers. It's named and used as GNU's seq. Seq takes the first and the last element as arguments. So Seq(3, 5) will generate [3,4,5]

func SortByLength added in v0.14.0

func SortByLength(values []string) []string

func SortKVByLength added in v0.14.0

func SortKVByLength(values []memkv.KVPair) []memkv.KVPair

func ToJson added in v0.13.7

func ToJson(v interface{}) (string, error)

func ToYaml added in v0.13.7

func ToYaml(v interface{}) (string, error)

func UnmarshalJsonArray added in v0.7.0

func UnmarshalJsonArray(data string) ([]interface{}, error)

func UnmarshalJsonObject added in v0.7.0

func UnmarshalJsonObject(data string) (map[string]interface{}, error)

Types

type Config added in v0.6.0

type Config struct {
	ConfDir       string
	ConfigDir     string
	KeepStageFile bool
	Noop          bool
	Prefix        string
	StoreClient   backends.StoreClient
	SyncOnly      bool
	TemplateDir   string
	PGPPrivateKey []byte
}

type Processor added in v0.7.0

type Processor interface {
	Process()
}

func IntervalProcessor added in v0.7.0

func IntervalProcessor(config Config, stopChan, doneChan chan bool, errChan chan error, interval int) Processor

func WatchProcessor added in v0.7.0

func WatchProcessor(config Config, stopChan, doneChan chan bool, errChan chan error) Processor

type TemplateResource

type TemplateResource struct {
	CheckCmd  string `toml:"check_cmd"`
	Dest      string
	FileMode  os.FileMode
	Gid       int
	Keys      []string
	Mode      string
	Prefix    string
	ReloadCmd string `toml:"reload_cmd"`
	Src       string
	StageFile *os.File
	Uid       int

	PGPPrivateKey []byte
	// contains filtered or unexported fields
}

TemplateResource is the representation of a parsed template resource.

func NewTemplateResource added in v0.7.0

func NewTemplateResource(path string, config Config) (*TemplateResource, error)

NewTemplateResource creates a TemplateResource.

type TemplateResourceConfig

type TemplateResourceConfig struct {
	TemplateResource TemplateResource `toml:"template"`
}

TemplateResourceConfig holds the parsed template resource.

Jump to

Keyboard shortcuts

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