util

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combine added in v0.4.3

func Combine(one, two map[string]string)

Combine merges two string maps

func GetHead added in v0.3.4

func GetHead(path string) (string, error)

GetHead returns the commit ID of the repo located at the given path

func IsDir added in v0.3.4

func IsDir(name string) bool

IsDir returns true if the given path corresponds to a directory

func PackageDir added in v0.3.4

func PackageDir(dir string, ignore []string) ([]byte, error)

PackageDir recursively adds files under the given directory to an in-memory tar file

func Render added in v0.4.2

func Render(name string, data []byte, v Values, funcs template.FuncMap) ([]byte, error)

func RenderFile added in v0.5.2

func RenderFile(name string, v Values, funcs template.FuncMap) ([]byte, error)

RenderFile reads a file and templates it according to the provided functions

Types

type Values

type Values map[interface{}]interface{}

Values represents mappings for go variables

func NewValues added in v0.4.3

func NewValues(from map[string]string) Values

func (Values) Append

func (v Values) Append(values Values)

Append overrides the current map with a new set of values

func (Values) AppendStr added in v0.4.3

func (v Values) AppendStr(values map[string]string)

AppendStr adds mapped strings

func (Values) Cascade

func (v Values) Cascade(current, key, field string) string

Cascade returns the first non empty value

func (Values) FromBytes

func (v Values) FromBytes(data []byte) error

FromBytes reads more key:value mappings from a byte slice

func (Values) FromFile

func (v Values) FromFile(fileName string) error

FromFile reads more key:value mappings from a file

func (Values) FromTemplate

func (v Values) FromTemplate(fileName string, funcs template.FuncMap) error

FromTemplate reads more key:value mappings from a templated file

func (Values) MarshalJSON added in v0.5.0

func (v Values) MarshalJSON() ([]byte, error)

func (Values) ToEnv added in v0.5.0

func (v Values) ToEnv(prefix string)

func (Values) ToSlice

func (v Values) ToSlice() []string

ToSlice converts key:value to key=value

Jump to

Keyboard shortcuts

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