-
Notifications
You must be signed in to change notification settings - Fork 1.5k
spanner: time.Time Field is not initialized in SelectAll #9381
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.
Description
Client
Spanner
Go Environment
Go1.21
Code
e.g.
type Singer struct {
ID int64 `spanner:"ID"`
Name string `spanner:"Name"`
LastUpdate time.Time `spanner:"LastUpdate"`
}
var singer []Singer
if err := spanner.SelectAll(iter, &singer); err != nil {
fmt.Println(err) // spanner: code = "InvalidArgument", desc = "Go struct {ID:0 Name: LastUpdate:0001-01-01 00:00:00 +0000 UTC}(type reflect.Value) has no or duplicate fields for Cloud Spanner STRUCT field LastUpdate"
return
}Additional context
-
The problem seems to be when entering the following branch.
google-cloud-go/spanner/row.go
Line 549 in 2fe67df
if fieldType.Type.Kind() == reflect.Struct { -
After initFieldTag,
fmt.Println(fieldTag) // map[ID:<int64 Value> Name:]no LastUpdate Field.
google-cloud-go/spanner/row.go
Line 511 in 2fe67df
initFieldTag(sliceItem, &fieldTag)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.