util

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuncMap = template.FuncMap{
	"Title":             strings.Title,
	"ToLower":           strings.ToLower,
	"CleanGoIdentifier": CleanGoIdentifier,
	"GenerateUUID":      uuid.New,
}

@TODO how can we make these type of helpers extensible?

Functions

func AppendProjectEnvToCmdEnv

func AppendProjectEnvToCmdEnv(envMap map[string]string, envList []string, translationMap map[string]string) []string

AppendProjectEnvToCmdEnv converts a key-value pair map into a slice of `key=value`s allow module definition to use an alternative env-var-name than field while apply

func CleanGoIdentifier

func CleanGoIdentifier(identifier string) string

func CreateDirIfDoesNotExist

func CreateDirIfDoesNotExist(path string) error

func ExecuteCommand

func ExecuteCommand(cmd *exec.Cmd, pathPrefix string, envars []string, shouldPipeStdErr bool) error

func ExecuteCommandOutput

func ExecuteCommandOutput(cmd *exec.Cmd, pathPrefix string, envars []string) string

ExecuteCommandOutput runs the command and returns its combined standard output and standard error.

func GetCwd

func GetCwd() string

func IndentString

func IndentString(content string, spaces int) string

IndentString will Add x space char padding at the beginging of each line.

func ItemInSlice

func ItemInSlice(slice []string, target string) bool

func ReflectStructValueIntoMap added in v0.1.0

func ReflectStructValueIntoMap(resource interface{}, tagName string, paramsToFill map[string]string)

ReflectStructValueIntoMap receives a resource of struct type as

type AWSCreds struct{
	AccessKeyID  string `yaml:"accessKeyId,omitempty"`
	SecretAccessKey  string `yaml:"secretAccessKey,omitempty"`
}{
	AccessKeyID: "FOO",
	SecretAccessKey: "BAR",
}

It will base on the tag, fill in the value to supplied map[string]string

Types

This section is empty.

Jump to

Keyboard shortcuts

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