| 50 | } |
| 51 | |
| 52 | func interfaceToString(value interface{}) (string, error) { |
| 53 | switch value := value.(type) { |
| 54 | case string: |
| 55 | return value, nil |
| 56 | case int: |
| 57 | return strconv.Itoa(value), nil |
| 58 | case int64: |
| 59 | return strconv.FormatInt(value, 10), nil |
| 60 | case float64: |
| 61 | return strconv.FormatFloat(value, 'f', -1, 64), nil |
| 62 | case bool: |
| 63 | return strconv.FormatBool(value), nil |
| 64 | case []byte: |
| 65 | return string(value), nil |
| 66 | default: |
| 67 | return "", errors.New("unsupported type") |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | //func byteToInterface(value []byte, dataType string) (interface{}, error) { |
| 72 | // switch dataType { |