(value interface{}, nullable bool)
| 441 | } |
| 442 | |
| 443 | func formatDbValue(value interface{}, nullable bool) string { |
| 444 | if nullable && value == nil { |
| 445 | return "NULL" |
| 446 | } |
| 447 | location, _ := time.LoadLocation(`UTC`) |
| 448 | switch value := value.(type) { |
| 449 | case time.Time: |
| 450 | return value.In(location).Format("2006-01-02T15:04:05.000-07:00") |
| 451 | case bool: |
| 452 | if value { |
| 453 | return `1` |
| 454 | } else { |
| 455 | return `0` |
| 456 | } |
| 457 | default: |
| 458 | if value != nil { |
| 459 | return fmt.Sprint(value) |
| 460 | } |
| 461 | } |
| 462 | return `` |
| 463 | } |
| 464 | |
| 465 | // ColumnWithRawData create a Column string with _raw_data_* appending |
| 466 | func ColumnWithRawData(column ...string) []string { |
no test coverage detected