gitlab.com/evatix-go/core@v1.3.55/coredata/corestr/AnyToString.go (about)

     1  package corestr
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"gitlab.com/evatix-go/core/constants"
     7  )
     8  
     9  func AnyToString(
    10  	isIncludeFieldName bool,
    11  	any interface{},
    12  ) string {
    13  	if any == "" {
    14  		return constants.EmptyString
    15  	}
    16  
    17  	val := reflectInterfaceVal(any)
    18  
    19  	if isIncludeFieldName {
    20  		return fmt.Sprintf(
    21  			constants.SprintPropertyNameValueFormat,
    22  			val)
    23  	}
    24  
    25  	return fmt.Sprintf(
    26  		constants.SprintValueFormat,
    27  		val)
    28  }