gitlab.com/evatix-go/core@v1.3.55/coreimpl/enumimpl/Format.go (about)

     1  package enumimpl
     2  
     3  import "gitlab.com/evatix-go/core/internal/strutilinternal"
     4  
     5  // Format
     6  //
     7  //  Outputs name and
     8  //  value by given format.
     9  //
    10  // sample-format :
    11  //  - "Enum of {type-name} - {name} - {value}"
    12  //
    13  // sample-format-output :
    14  //  - "Enum of EnumFullName - Invalid - 0"
    15  //
    16  // Key-Meaning :
    17  //  - {type-name} : represents type-name string
    18  //  - {name}      : represents name string
    19  //  - {value}     : represents value string
    20  func Format(
    21  	typeName,
    22  	enumName,
    23  	valueString string,
    24  	format string,
    25  ) string {
    26  	replacerMap := map[string]string{
    27  		typeNameTemplateKey: typeName,
    28  		nameKey:             enumName,
    29  		valueKey:            valueString,
    30  	}
    31  
    32  	return strutilinternal.ReplaceTemplateMap(
    33  		true,
    34  		format,
    35  		replacerMap)
    36  }