utils

package
v0.0.0-...-1b0671e Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2016 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	AlignRight = 1
	AlignLeft  = 2
)
View Source
const (
	FN_INCLUDE_FILE_LINES = "Fn::Local::IncludeFileLines"
)

Variables

This section is empty.

Functions

func AddDirective

func AddDirective(df DirectiveFunc)

func ApplyDirectives

func ApplyDirectives(templ []byte) string

func ApplyIncludeEnvDirective

func ApplyIncludeEnvDirective(reader io.Reader) []byte

func ApplyIncludeFileLinesDirective

func ApplyIncludeFileLinesDirective(reader io.Reader) []byte

func CustomScanLines

func CustomScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)

instead of stripping the CR, we maintain it..

func DecodeHJSON

func DecodeHJSON(hjsonInput []byte) (map[string]interface{}, error)

func DecodeYAML

func DecodeYAML(yamlInput []byte) (map[string]interface{}, error)

func DecodeYAMLFile

func DecodeYAMLFile(yamlFilePath string) (map[string]interface{}, error)

func DeepToStrMap

func DeepToStrMap(input map[string]interface{}) map[string]interface{}

func DeleteAtIndex

func DeleteAtIndex(into []interface{}, index int) []interface{}

func EncodeJSON

func EncodeJSON(document interface{}) []byte

func EncodeYAML

func EncodeYAML(data interface{}) []byte

func EscapeStackVer

func EscapeStackVer(version string) string

func FileExists

func FileExists(filename string) bool

func FileLines

func FileLines(filename string, sub bool) []interface{}

func FnFileLinesInclude

func FnFileLinesInclude(input interface{}) interface{}

func GenerateJSONFromYaml

func GenerateJSONFromYaml(yamlInput []byte) []byte

func GetenvWithDefault

func GetenvWithDefault(key string, defaultValue string) string

func InsertAtIndex

func InsertAtIndex(into []interface{}, index int, val ...interface{}) []interface{}

func InsertStrAtIndex

func InsertStrAtIndex(into []string, index int, val ...string) []string

string array insert

func KeyExists

func KeyExists(key string, input map[string]interface{}) bool

func MaxInt

func MaxInt(x, y int) int

func MinInt

func MinInt(x, y int) int

func SetenvIfAbsent

func SetenvIfAbsent(key, value string)

func TemporaryChdir

func TemporaryChdir(dir string, runItInDir func())

dir functions

func TemporaryEnv

func TemporaryEnv(name, value string, runIt func())

func ToStrMap

func ToStrMap(in interface{}) map[string]interface{}

Types

type DirectiveFunc

type DirectiveFunc func(reader io.Reader) []byte

type TableWriter

type TableWriter struct {
	Align int
	// contains filtered or unexported fields
}

func NewTableWriter

func NewTableWriter(w io.Writer, colLens ...int) *TableWriter

func (*TableWriter) Footer

func (t *TableWriter) Footer()

func (*TableWriter) WriteHeader

func (t *TableWriter) WriteHeader(headers ...string)

func (*TableWriter) WriteRow

func (t *TableWriter) WriteRow(columns ...string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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