(value interface{})
| 17 | type StringConverter struct{} |
| 18 | |
| 19 | func (c StringConverter) ToString(value interface{}) string { |
| 20 | switch value := value.(type) { |
| 21 | case []int, []float64, []bool, []string: |
| 22 | array := c.ToStringArray(value) |
| 23 | return strings.Join(array, ",") |
| 24 | case int: |
| 25 | return strconv.Itoa(value) |
| 26 | case float64: |
| 27 | return strconv.FormatFloat(value, 'f', -1, 64) |
| 28 | case bool: |
| 29 | return strconv.FormatBool(value) |
| 30 | case string: |
| 31 | return value |
| 32 | default: |
| 33 | return fmt.Sprint(value) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | func (c StringConverter) ToStringArray(value interface{}) []string { |
| 38 | switch value := value.(type) { |
no test coverage detected