helpers

package
v0.0.0-...-a4d1c73 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Overview

Package helpers has some useful functions to choose parser and ease scan maps and slices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountLeadingSpaces

func CountLeadingSpaces(line string) int

CountLeadingSpaces counts leading spaces. It's used in checkYamlIndentation() to find indentation error in template.

func Discard

func Discard(slice []interface{}, n interface{}) []interface{}

Discard looks for elements which are not the same and return only unique.

func GetParser

func GetParser(filename string) (func([]byte, template.Template, logger.LoggerInt) (cloudformation.Template, error), error)

GetParser chooses parser based on file extension.

func IsNonStringFloatBool

func IsNonStringFloatBool(v interface{}) bool

IsNonStringFloatBool checks if the element is non-string, non-float64, non-boolean. Then it is another node or <nil>. There is no other option.

func IsPlainMap

func IsPlainMap(mp map[string]interface{}) bool

IsPlainMap checks if map is plain. Plain map means that it's non-nil and it doesn't contain nested maps. It's used in checkWhereIsNil().

func IsPlainSlice

func IsPlainSlice(slc []interface{}) bool

IsPlainSlice checks if slice is plain. Slice is plain if it's non-nil and doesn't contain nested maps. It's used in checkWhereIsNil().

func ParseJSON

func ParseJSON(templateFile []byte, refTemplate template.Template, logger logger.LoggerInt) (template cloudformation.Template, err error)

ParseJSON parses JSON template file to cloudformation template.

func ParseYAML

func ParseYAML(templateFile []byte, refTemplate template.Template, logger logger.LoggerInt) (template cloudformation.Template, err error)

ParseYAML parses YAML template file to cloudformation template.

func PrettyPrintJSON

func PrettyPrintJSON(toPrint interface{}) ([]byte, error)

PrettyPrintJSON prepares JSON file with indent to ease reading it.

func SliceContains

func SliceContains(list []string, a string) bool

SliceContains checks if slice contains given string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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