Skip to content

Commit

Permalink
Adding logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Nov 14, 2024
1 parent 123b734 commit 6294626
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/typing/values/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ func ToString(colVal any, colKind typing.KindDetails) (string, error) {
case typing.Date.Kind:
_time, err := ext.ParseDateFromAny(colVal)
if err != nil {
return "", fmt.Errorf("failed to cast colVal as time.Time, colVal: '%v', err: %w", colVal, err)
return "", fmt.Errorf("failed to cast colVal as time.Time for DATE, colVal: '%v', err: %w", colVal, err)
}

return _time.Format(ext.PostgresDateFormat), nil
case typing.Time.Kind:
_time, err := ext.ParseTimeFromAny(colVal)
if err != nil {
return "", fmt.Errorf("failed to cast colVal as time.Time, colVal: '%v', err: %w", colVal, err)
return "", fmt.Errorf("failed to cast colVal as time.Time for TIME, colVal: '%v', err: %w", colVal, err)
}

return _time.Format(ext.PostgresTimeFormatNoTZ), nil
case typing.TimestampNTZ.Kind:
_time, err := ext.ParseTimestampNTZFromAny(colVal)
if err != nil {
return "", fmt.Errorf("failed to cast colVal as time.Time, colVal: '%v', err: %w", colVal, err)
return "", fmt.Errorf("failed to cast colVal as time.Time for Timestamp NTZ, colVal: '%v', err: %w", colVal, err)
}

return _time.Format(ext.RFC3339NoTZ), nil
case typing.TimestampTZ.Kind:
_time, err := ext.ParseTimestampTZFromAny(colVal)
if err != nil {
return "", fmt.Errorf("failed to cast colVal as time.Time, colVal: '%v', err: %w", colVal, err)
return "", fmt.Errorf("failed to cast colVal as time.Time for Timestamp TZ, colVal: '%v', err: %w", colVal, err)
}

return _time.Format(time.RFC3339Nano), nil
Expand Down

0 comments on commit 6294626

Please sign in to comment.