helpers

package
v0.0.0-...-8f5bff0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: MIT Imports: 13 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// SchemaBox is the packr box containing the resource file templates
	SchemaBox = packr.New("schema", "../../templates/schema")
	// ResourceBox is the packr box containing the resource file templates
	ResourceBox = packr.New("resource", "../../templates/resource")
	// FunctionBox is the packr box containing the function file templates
	FunctionBox = packr.New("function", "../../templates/function")
	// MakeBox is the packr box containing the Makefile template
	MakeBox = packr.New("make", "../../templates/make")
	// RemoveBox is the packr box containing the schema template to be rerender when a resource is removed
	RemoveBox = packr.New("remove", "../../templates/remove")
)

Functions

func AppendStringIfMissing

func AppendStringIfMissing(slice []string, i string) []string

AppendStringIfMissing appends an element to a slice, if it doesn't contain the element already

func AwsType

func AwsType(s string) string

AwsType returns the AWS datatype for a given golang type

func Contains

func Contains(s []string, v string) bool

Contains checks whether a string slice contains a given string

func CreateLambdaNetwork

func CreateLambdaNetwork() error

CreateLambdaNetwork spins up a lambda network for dynamodb and AWS SAM to interact with one another

func ExecuteCommand

func ExecuteCommand(cmd *cobra.Command, args ...string) (output string, err error)

ExecuteCommand executes a command from anywhere

func GetFuncName

func GetFuncName(resourceName, functionName string) string

GetFuncName returns the generated function name for a given resource/ function group name and a functionName

func GetList

func GetList(projectPath, wish string) ([]string, error)

GetList returns the list of deployable/ debugable resources/ function groups

func GetProjectPath

func GetProjectPath(path string) string

GetProjectPath gets the OS path of the project

func GetWorkingDir

func GetWorkingDir() (string, error)

GetWorkingDir get the directory the current command is run out of

func LoadTemplateFromBox

func LoadTemplateFromBox(b *packr.Box, file string) (*template.Template, error)

LoadTemplateFromBox loads a *text/template.Template from a packr.Box

func ReadDataFromFile

func ReadDataFromFile(path string) ([]byte, error)

ReadDataFromFile reads the contents of a file at the given path

func RenderFile

func RenderFile(box *packr.Box, fName, tPath, folder string, data map[string]interface{}) error

RenderFile renders a template to the file at folder/fName with the given data

func RunCmd

func RunCmd(name string, args ...string) error

RunCmd will run an OS command with the given arguments

func RunCmdWithEnv

func RunCmdWithEnv(envs []string, name string, args ...string) error

RunCmdWithEnv will run an OS command with the given arguments and an environment

func StartLocalDynamoDB

func StartLocalDynamoDB() error

StartLocalDynamoDB spins up the dynamodb-local docker image

Types

This section is empty.

Jump to

Keyboard shortcuts

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