Write time.Time results as DateTime fields in the spatial writer - #152
Merged
Merged
Conversation
time.Time has reflect kind Struct, which gdalTypes does not map, so the field was created as Integer and the value switch skipped it: completion_date was never written. Create the field as DateTime and set it with SetFieldDateTime; a zero time stays null.
HenryGeorgist
self-requested a review
September 23, 2026 20:32
trietmnj
marked this pull request as ready for review
September 23, 2026 20:37
HenryGeorgist
approved these changes
Sep 23, 2026
| "github.com/dewberry/gdal" | ||
| ) | ||
|
|
||
| func TestSpatialResultsWriterWritesDateTime(t *testing.T) { |
Contributor
There was a problem hiding this comment.
thanks for adding the test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
time.Timevalues.time.Timehas reflect kindStruct, whichgdalTypesdoes not map, so the field is created with GDAL's zero type (Integer), and the value switch has no case for it. The lifecyclecompletion_datecolumn is null in every row (all 437,893 event rows of a DE001 run).FT_DateTimewhen the value is atime.Time, and write it withSetFieldDateTime; a zero time stays null. Newspatialwriter_test.gowrites a GeoPackage and reads the date back.