From 962c55681c9a6e876d39d2241491d272b86d7422 Mon Sep 17 00:00:00 2001 From: Lance Rushing Date: Tue, 26 Dec 2023 13:27:21 -0800 Subject: [PATCH] Add comments for new functions Signed-off-by: Lance Rushing --- stores/flatten.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stores/flatten.go b/stores/flatten.go index b0e9c06cd9..c894e6e298 100644 --- a/stores/flatten.go +++ b/stores/flatten.go @@ -61,6 +61,7 @@ func Flatten(in map[string]interface{}) map[string]interface{} { return newMap } +// FlattenMetadata flattens a Metadata struct into a flat map. func FlattenMetadata(md Metadata) (map[string]interface{}, error) { var mdMap map[string]interface{} jsonBytes, err := json.Marshal(md) @@ -214,6 +215,8 @@ func UnflattenMetadata(in map[string]interface{}) (Metadata, error) { return md, err } +// DecodeNewLines replaces \\n with \n for all string values in the map. +// Used by config stores that do not handle multi-line values (ini, dotenv). func DecodeNewLines(m map[string]interface{}) { for k, v := range m { if s, ok := v.(string); ok { @@ -222,6 +225,8 @@ func DecodeNewLines(m map[string]interface{}) { } } +// EncodeNewLines replaces \n with \\n for all string values in the map. +// Used by config stores that do not handle multi-line values (ini, dotenv). func EncodeNewLines(m map[string]interface{}) { for k, v := range m { if s, ok := v.(string); ok {