Documentation
¶
Index ¶
- func AddLogWhenValExist(title string, val string) string
- func AppendStringIfNotMember(list []string, item string) []string
- func Contains(listToCheck []string, toFind string, isCaseSensitive bool) bool
- func Copy(src, dst string) error
- func CopyDirectory(opts CopyDirectoryOpts) error
- func CopySymLink(src, dst string) error
- func ExtractFirstJSONFromString(s string) string
- func HashString(s string) (string, error)
- func JSONMarshalUnescaped(v interface{}) (string, error)
- func JSONMarshalUnescapedIndent(v interface{}) (string, error)
- func JSONUnmarshal(data []byte, v interface{}) error
- func MapToStringSlice(args map[string]string, prefix string) []string
- func MapToStringSliceKeys(args map[string]struct{}) []string
- func MergeJSON(defaultJSON string, customJSON string, config interface{}) error
- func RedactPII(s string) string
- func ShouldIgnore(val string, list []string, ignoreFunc func(string) bool) bool
- func ToHTTPS(urlAddr string) string
- func UpperCaseTrimAll(namedEntities string) string
- type CopyDirectoryOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLogWhenValExist ¶
AddLogWhenValExist returns a formatted string if value exists
func AppendStringIfNotMember ¶
AppendStringIfNotMember only appends if not already a member
func Contains ¶
Contains returns true if a string can be found in a list of strings, false otherwise isCaseSensitive defines whether the string needs to match capitalization to return true case sensitivity based on Unicode case-folding, more general form of case-insensitivity
func CopyDirectory ¶
func CopyDirectory(opts CopyDirectoryOpts) error
CopyDirectory recursively copies a src directory to a destination.
func CopySymLink ¶
CopySymLink copies a symbolic link from src to dst.
func ExtractFirstJSONFromString ¶
ExtractFirstJSONFromString returns the first bracket-balanced json-looking substring in a string It returns the empty string if the string has no json-looking substring or does not have a json-looking substring with balanced brackets
Sometimes, when we run hooks, they return the expected json object but with some other warning messages that we don't need. This causes errors when unmarshalling. This function helps us extract exactly what we need and ignore the rest.
func HashString ¶
HashString will compute a short sha1 identity for a text blob
func JSONMarshalUnescaped ¶
JSONMarshalUnescaped converts a struct into a JSON encoding without escaping characters
func JSONMarshalUnescapedIndent ¶
JSONMarshalUnescapedIndent converts a struct into an easily readable JSON encoding without escaping characters
func JSONUnmarshal ¶
JSONUnmarshal is a wrapper for json.Unmarshal which parses the JSON-encoded data and stores the result in the value pointed to by v. If v is nil or not a pointer, json.Unmarshal returns an InvalidUnmarshalError which gets converted to a slackerror that is more human readable.
func MapToStringSlice ¶
MapToStringSlice converts a map[string]string to a slice of strings with elements key="value" from the map with an optional prefix
func MapToStringSliceKeys ¶
MapToStringSliceKeys takes a map[string]interface{} and returns its keys as a slice of strings
func MergeJSON ¶
MergeJSON will merge customJSON into defaultJSON and unmarshal the results to config. When JSON arguments are an empty string, it will default the arg to "{}"
func RedactPII ¶
RedactPII will replace all occurrences in a string that match any of the expressions in a regex list
func ShouldIgnore ¶
ShouldIgnore returns true if a file or directory is in the exclusion list or ignore function
func UpperCaseTrimAll ¶
UpperCaseTrimAll returns a formatted named_entites for trigger ACLs