From 32a755f98906163c909316abb04596ea18b6f263 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Mon, 2 Jan 2023 08:35:54 +0000 Subject: [PATCH] Adds notes to functions (#5824) (#5826) * added notes Signed-off-by: Vishal Choudhary * changes stated in chart.yaml Signed-off-by: Vishal Choudhary * undo Signed-off-by: Vishal Choudhary Signed-off-by: Vishal Choudhary Signed-off-by: Vishal Choudhary Co-authored-by: Vishal Choudhary --- pkg/engine/jmespath/functions.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/engine/jmespath/functions.go b/pkg/engine/jmespath/functions.go index bc8f3a1b77..8d2555fc88 100644 --- a/pkg/engine/jmespath/functions.go +++ b/pkg/engine/jmespath/functions.go @@ -129,6 +129,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfCompare, }, ReturnType: []JpType{JpNumber}, + Note: "compares two strings lexicographically", }, { Entry: &gojmespath.FunctionEntry{ @@ -140,6 +141,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfEqualFold, }, ReturnType: []JpType{JpBool}, + Note: "allows comparing two strings for equivalency where the only differences are letter cases", }, { Entry: &gojmespath.FunctionEntry{ @@ -153,6 +155,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfReplace, }, ReturnType: []JpType{JpString}, + Note: "replaces a specified number of instances of the source string with the replacement string in a parent ", }, { Entry: &gojmespath.FunctionEntry{ @@ -165,6 +168,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfReplaceAll, }, ReturnType: []JpType{JpString}, + Note: "replace all instances of one string with another in an overall parent string", }, { Entry: &gojmespath.FunctionEntry{ @@ -175,6 +179,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfToUpper, }, ReturnType: []JpType{JpString}, + Note: "takes in a string and outputs the same string with all upper-case letters", }, { Entry: &gojmespath.FunctionEntry{ @@ -185,6 +190,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfToLower, }, ReturnType: []JpType{JpString}, + Note: "takes in a string and outputs the same string with all lower-case letters", }, { Entry: &gojmespath.FunctionEntry{ @@ -196,6 +202,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfTrim, }, ReturnType: []JpType{JpString}, + Note: "trims both ends of the source string by characters appearing in the second string", }, { Entry: &gojmespath.FunctionEntry{ @@ -207,6 +214,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpfSplit, }, ReturnType: []JpType{JpArrayString}, + Note: "splits the first string when the second string is found and converts it into an array ", }, { Entry: &gojmespath.FunctionEntry{ @@ -244,6 +252,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpRegexMatch, }, ReturnType: []JpType{JpBool}, + Note: "first string is the regular exression which is compared with second input which can be a number or string", }, { Entry: &gojmespath.FunctionEntry{ @@ -280,6 +289,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpAdd, }, ReturnType: []JpType{JpAny}, + Note: "does arithmetic addition of two specified values of numbers, quantities, and durations", }, { Entry: &gojmespath.FunctionEntry{ @@ -291,6 +301,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpSubtract, }, ReturnType: []JpType{JpAny}, + Note: "does arithmetic subtraction of two specified values of numbers, quantities, and durations", }, { Entry: &gojmespath.FunctionEntry{ @@ -302,6 +313,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpMultiply, }, ReturnType: []JpType{JpAny}, + Note: "does arithmetic multiplication of two specified values of numbers, quantities, and durations", }, { Entry: &gojmespath.FunctionEntry{ @@ -336,6 +348,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpBase64Decode, }, ReturnType: []JpType{JpString}, + Note: "decodes a base 64 string", }, { Entry: &gojmespath.FunctionEntry{ @@ -346,6 +359,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpBase64Encode, }, ReturnType: []JpType{JpString}, + Note: "encodes a regular, plaintext and unencoded string to base64", }, { Entry: &gojmespath.FunctionEntry{ @@ -358,6 +372,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpTimeSince, }, ReturnType: []JpType{JpString}, + Note: "calculate the difference between a start and end period of time where the end may either be a static definition or the then-current time", }, { Entry: &gojmespath.FunctionEntry{ @@ -368,6 +383,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpPathCanonicalize, }, ReturnType: []JpType{JpString}, + Note: "normalizes or canonicalizes a given path by removing excess slashes", }, { Entry: &gojmespath.FunctionEntry{ @@ -391,6 +407,7 @@ func GetFunctions() []*FunctionEntry { Handler: jpSemverCompare, }, ReturnType: []JpType{JpBool}, + Note: "compares two strings which comply with the semantic versioning schema and outputs a boolean response as to the position of the second relative to the first", }, { Entry: &gojmespath.FunctionEntry{