Skip to content

Commit

Permalink
Needs to expressed in Civil time.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 24, 2024
1 parent 0b164f9 commit e8f7335
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clients/bigquery/storagewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,14 @@ func rowToMessage(row map[string]any, columns []columns.Column, messageDescripto
case ext.DateKindType:
daysSinceEpoch := _time.Unix() / (60 * 60 * 24)
message.Set(field, protoreflect.ValueOfInt32(int32(daysSinceEpoch)))
case ext.TimestampTZKindType, ext.TimestampNTZKindType:
case ext.TimestampTZKindType:
if err = timestamppb.New(_time).CheckValid(); err != nil {
return nil, err
}
message.Set(field, protoreflect.ValueOfInt64(_time.UnixMicro()))
case ext.TimestampNTZKindType:
civilLayout := "2006-01-02 15:04:05.999999"
message.Set(field, protoreflect.ValueOfString(_time.Format(civilLayout)))
default:
return nil, fmt.Errorf("unsupported extended time details: %q", column.KindDetails.ExtendedTimeDetails.Type)
}
Expand Down

0 comments on commit e8f7335

Please sign in to comment.