-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More refactor around ExtendedTime
#979
Changes from all commits
66ae321
d0259a2
56758e3
75aff02
b4d2ca0
952cf23
124de66
4f13660
9dcf5cf
5dbbb76
0fc2686
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,18 +119,18 @@ func (s *Store) writeTemporaryTableFile(tableData *optimization.TableData, newTa | |
writer.Comma = '\t' | ||
|
||
columns := tableData.ReadOnlyInMemoryCols().ValidColumns() | ||
for _, value := range tableData.Rows() { | ||
var row []string | ||
for _, row := range tableData.Rows() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed the variable so it's less confusing |
||
var csvRow []string | ||
for _, col := range columns { | ||
castedValue, castErr := castColValStaging(value[col.Name()], col.KindDetails) | ||
castedValue, castErr := castColValStaging(row[col.Name()], col.KindDetails) | ||
if castErr != nil { | ||
return "", castErr | ||
return "", fmt.Errorf("failed to cast value '%v': %w", row[col.Name()], castErr) | ||
} | ||
|
||
row = append(row, castedValue) | ||
csvRow = append(csvRow, castedValue) | ||
} | ||
|
||
if err = writer.Write(row); err != nil { | ||
if err = writer.Write(csvRow); err != nil { | ||
return "", fmt.Errorf("failed to write to csv: %w", err) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,8 +81,3 @@ func (e *ExtendedTime) GetTime() time.Time { | |
func (e *ExtendedTime) GetNestedKind() NestedKind { | ||
return e.nestedKind | ||
} | ||
|
||
func (e *ExtendedTime) String(overrideFormat string) string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer used! |
||
format := cmp.Or(overrideFormat, e.nestedKind.Format) | ||
return e.ts.Format(format) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,10 @@ func (k *KindDetails) EnsureExtendedTimeDetails() error { | |
return fmt.Errorf("extended time details is not set") | ||
} | ||
|
||
if k.ExtendedTimeDetails.Format == "" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an additional guardrail to ensure we don't do |
||
return fmt.Errorf("extended time details format is not set") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the column format instead of
.String()
which relies on the value format.