MCPcopy
hub / github.com/apache/devlake / formatDbValue

Function formatDbValue

backend/helpers/e2ehelper/data_flow_tester.go:443–463  ·  view source on GitHub ↗
(value interface{}, nullable bool)

Source from the content-addressed store, hash-verified

441}
442
443func 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
466func ColumnWithRawData(column ...string) []string {

Callers 1

Calls 1

FormatMethod · 0.80

Tested by

no test coverage detected