v0.3.1
Patch release since v0.3.0: additive RowEncoder APIs and internal adoption of spanvalue gcvctor constructors. No breaking changes. Mirrored semantics still track cloud.google.com/go/spanner v1.91.0.
Added
RowEncoder.Row(v, encodeOpts...)/RowEncoder.Rows(items, encodeOpts...)(#2): encode structs into real*spanner.Rowvalues so client-side (virtual) result sets flow through the same*spanner.Rowpipelines as server query results.RowisValues+spanner.NewRow(the client deep-clones the GCVs without re-encoding, so rows carry exactly the encoder's output including typed NULLs and do not alias encoder state).Rowsreturns a lazyiter.Seq2[*spanner.Row, error]— each row is encoded only when yielded (pinned by test), and an encode failure yields(nil, err)once and stops. Pairs withwriter.RunRowSeq/writer.WriteRowSeqintroduced in spanvalue v0.7.4, whose abort-on-yielded-error contract matches by design.MustNewRowEncoder[T]:NewRowEncoderpanicking on error, for package-level encoders of compile-time-known struct types — prefer it over local panic-on-error wrappers (surveyed from the spanner-mycli PoC, apstndb/spanner-mycli#657).
Changed (no behavior change)
- Hand-rolled nullable encoding helpers were replaced with the
gcvctorconstructors added for spanenc in spanvalue v0.7.2–v0.7.3 (apstndb/spanvalue#232, apstndb/spanvalue#236):IntervalFromNullable,NumericFromNullable(behind the existing NUMERIC validation),PGNumericFromNullable,JSONFromNullable,PGJSONBFromNullable. Client-mirror semantics are unchanged and pinned by tests, including the quoted-JSON-string wire for string-valuedNullJSON/PGJsonB(fixed on the spanvalue side in v0.7.3; spanenc deliberately skipped the v0.7.2 helpers whose string special-case diverged from the client).
Documentation
- Adoption guide: the string-only-row exception now spells out when routing display strings through GCVs is worth it (a single cell pipeline shared with server results, or scaffolding call sites that will gain typed columns) and asks adopters to record that intent in a comment; NULL cells should be detected with
spanvalue.IsNullrather than inspecting the protobuf value kind by hand.
Requirements
github.com/apstndb/spanvaluev0.7.3+ (gcvctorJSONFromNullable/PGJSONBFromNullablewith client-compatible marshal semantics). StreamingRowEncoder.Rowsoutput throughwriter.WriteRowSeqadditionally needs spanvalue v0.7.4+.github.com/apstndb/structfieldsv0.1.0 /structfields/spannertagv0.1.0 (unchanged).cloud.google.com/go/spanner: go.mod declares only the v1.84.1 MVS floor (mirrored semantics track v1.91.0); your module controls the actual client version.