Skip to content

Commit

Permalink
spanner: fix parsing incorrect types/values into a time.Time
Browse files Browse the repository at this point in the history
There was a `return nil` where a `return err` was clearly intended.

Change-Id: I44368292a64e47f7b4d300198543d2f777504af7
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/43930
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Knut Olav Løite <koloite@gmail.com>
  • Loading branch information
dsymonds committed Aug 13, 2019
1 parent 56edb30 commit 9a7f354
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spanner/value.go
Expand Up @@ -602,7 +602,7 @@ func decodeValue(v *proto3.Value, t *sppb.Type, ptr interface{}) error {
}
err := parseNullTime(v, &nt, code, isNull)
if err != nil {
return nil
return err
}
*p = nt.Time
case *NullTime:
Expand Down
1 change: 1 addition & 0 deletions spanner/value_test.go
Expand Up @@ -773,6 +773,7 @@ func TestDecodeValue(t *testing.T) {
{timeProto(t1), timeType(), t1, false},
{timeProto(t1), timeType(), NullTime{t1, true}, false},
{nullProto(), timeType(), NullTime{}, false},
{intProto(7), timeType(), time.Time{}, true},
// TIMESTAMP ARRAY with []NullTime
{listProto(timeProto(t1), timeProto(t2), timeProto(t3), nullProto()), listType(timeType()), []NullTime{{t1, true}, {t2, true}, {t3, true}, {}}, false},
{nullProto(), listType(timeType()), []NullTime(nil), false},
Expand Down

0 comments on commit 9a7f354

Please sign in to comment.