gitlab.com/evatix-go/core@v1.3.55/coreappend/MapStringStringToMapStringToAnyItems.go (about)

     1  package coreappend
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"gitlab.com/evatix-go/core/constants"
     7  )
     8  
     9  func MapStringStringAppendMapStringToAnyItems(
    10  	isSkipEmpty bool,
    11  	mainMap map[string]string,
    12  	appendMapItems map[string]interface{},
    13  ) map[string]string {
    14  	if len(appendMapItems) == 0 {
    15  		return mainMap
    16  	}
    17  
    18  	for key, valInf := range appendMapItems {
    19  		val := fmt.Sprintf(
    20  			constants.SprintValueFormat,
    21  			valInf)
    22  
    23  		if isSkipEmpty && val == "" {
    24  			continue
    25  		}
    26  
    27  		mainMap[key] = val
    28  	}
    29  
    30  	return mainMap
    31  }