helper

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultImageTag string = "latest"
	ImageSeparator  string = ":"
)

Variables

This section is empty.

Functions

func AddFileExtension

func AddFileExtension(filename, outputType string) string

func CleanJSON added in v1.12.3

func CleanJSON(jsonString string) (string, error)

CleanJSON removes trailing carriage return, newline, and backslash from a JSON string.

func CleanValue added in v1.12.3

func CleanValue(v interface{}) interface{}

CleanValue removes trailing carriage return, newline, and backslash from a JSON value.

func DetectCDXHashAlgorithm added in v1.13.0

func DetectCDXHashAlgorithm(hash string) cyclonedx.HashAlgorithm

DetectHashAlgorithm identifies the hash algorithm based on the input hash.

func FormatImage

func FormatImage(image string) string

FormatImage set default image tag if not provided

func GenerateURN

func GenerateURN(nid string) string

func IsDir

func IsDir(path string) bool

IsDir checks if the given input is a directory. It returns true if the input is a directory, false otherwise.

func IsDirExists

func IsDirExists(path string) (bool, error)

IsDirExists checks if a directory exists and is valid.

func IsFileExists

func IsFileExists(path string) (bool, error)

IsFileExists checks if a file exists and is valid.

func SaveToFile

func SaveToFile(data interface{}, path, format string) error

func SplitAndAppendStrings

func SplitAndAppendStrings(target []string) []string

func SplitAny added in v1.13.0

func SplitAny(s string, seps string) []string

func SplitContentsByEmptyLine

func SplitContentsByEmptyLine(contents string) []string

func SplitString

func SplitString(str string) []string

func StringSliceContains

func StringSliceContains(s []string, e string) bool

StringSliceContains checks if a string slice contains specified string

func ToJSON

func ToJSON(t interface{}) ([]byte, error)

func ToTitle

func ToTitle(str string) string

func ToXML

func ToXML(data interface{}) ([]byte, error)

func ToYAML

func ToYAML(t interface{}) ([]byte, error)

func WriteFile

func WriteFile(data []byte, path string) error

func WriteYAML

func WriteYAML(t interface{}, path string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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