| 72 | } |
| 73 | |
| 74 | func (f *Field) GetText() string { |
| 75 | if f.value == nil { |
| 76 | return "" |
| 77 | } |
| 78 | switch f.value.(type) { |
| 79 | case bool: |
| 80 | if f.value.(bool) { |
| 81 | return "true" |
| 82 | } |
| 83 | return "false" |
| 84 | case int32: |
| 85 | return int32ToString(f.value.(int32)) |
| 86 | case int64: |
| 87 | return int64ToString(f.value.(int64)) |
| 88 | case float32: |
| 89 | return float32ToString(f.value.(float32)) |
| 90 | case float64: |
| 91 | return float64ToString(f.value.(float64)) |
| 92 | case string: |
| 93 | return f.value.(string) |
| 94 | case []byte: |
| 95 | return bytesToHexString(f.value.([]byte)) |
| 96 | case time.Time: |
| 97 | return f.value.(time.Time).Format("2006-01-02") |
| 98 | } |
| 99 | return "" |
| 100 | } |