Documentation
¶
Index ¶
Constants ¶
View Source
const ( // KeyKey placeholder will be formatted to map key KeyKey = "key" // KeyValue placeholder will be formatted to map value KeyValue = "value" )
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format
Func that makes string formatting from template * It differs from above function only by generic interface that allow to use only primitive data types: * - integers (int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uin64) * - floats (float32, float64) * - boolean * - string * - complex * - objects * This function defines format automatically * Parameters * - template - string that contains template * - args - values that are using for formatting with template * Returns formatted string
func FormatComplex ¶
FormatComplex
Function that format text using more complex templates contains string literals i.e "Hello {username} here is our application {appname} * Parameters * - template - string that contains template * - args - values (dictionary: string key - any value) that are using for formatting with template * Returns formatted string
func MapToString ¶ added in v1.1.0
func MapToString[ K string | int | uint | int32 | int64 | uint32 | uint64, V any, ](data map[K]V, format string, separator string) string
MapToString - format map keys and values according to format, joining parts with separator. Format should contain key and value placeholders which will be used for formatting, e.g. "{key} : {value}", or "{value}", or "{key} => {value}". Parts order in resulting string is not guranteed.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.