Skip to content

Commit

Permalink
spanner: Allow encoding and decoding to pointers
Browse files Browse the repository at this point in the history
This CL adds support for decoding and encoding Spanner values to fields
that have a pointer type to a base type. This makes working with
nullable values more natural, as it makes it possible to define a field
as *string instead of having to use the special spanner.NullString
type.

This CL does NOT add support for decoding and encoding to pointers to
custom types that point back to base types. I.e. the following struct
cannot be used to decode rows from Spanner.

type CustomString string
type Entity struct {
  ID *CustomString
}

Fixes #1684

Change-Id: Id5cb4c0b189d27ab9c7fff4b37be1cc69c7644b7
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/50650
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hengfeng Li <hengfeng@google.com>
  • Loading branch information
olavloite committed Jan 28, 2020
1 parent 297277d commit fbe1038
Show file tree
Hide file tree
Showing 2 changed files with 659 additions and 56 deletions.
Loading

0 comments on commit fbe1038

Please sign in to comment.