v0.3.0
Stable release consolidating v0.3.0-alpha.1 and v0.3.0-alpha.2 plus documentation work. Mirrored semantics track cloud.google.com/go/spanner v1.91.0.
Added since v0.2.0
- Column masks for the plain-Go-value helpers (
ColumnMaskOption):WithColumns(...)(include) /WithoutColumns(...)(exclude) onMutationColumnsAndValues,MutationMap, andParamsMap. Masked output keeps struct declaration order; unknown columns, read-only columns in a write-shaped include list, or combining both kinds return the newErrInvalidColumnMask. WithLossOfPrecisionHandling(spanner.NumericError | spanner.NumericRound)(EncodeOption): per-call NUMERIC loss-of-precision control reusing the client's enum. The client's package-global is never read; the default here isspanner.NumericError(validate →ErrNumericOutOfRange), while the client's global defaults toNumericRound.ParamsMap: struct →map[string]anyforspanner.StatementParams (no GCV conversion; read-only fields included, since they are ordinary bindable values).ResultSetMetadataFor[T]/ResultSetMetadataFromGoType:RowTypeForwrapped in*sppb.ResultSetMetadatafor writer metadata and client-side virtual result sets.RowEncoder[T](NewRowEncoder): compiled row codec — field listing, column mask, and row type resolved once; per row onlyValues(v, encodeOpts...)runs.Columns()/RowType()/ResultSetMetadata()are mask-aware; agreement withStructColumnsAndValuesis pinned by tests.
Documentation
- Package-doc Adoption guide (readable from
go doc/ pkg.go.dev): when GCV-based rows pay off vs plain string rows;Columns()vsResultSetMetadata(); formatting stability across spanvalue upgrades; cross-links tospanvalue.FormatRowColumnsso adopters need no per-app GCV→string bridge. Driven by spanner-mycli PoC feedback (#1). ExampleStructColumns_tagOptionspins the tag-option quirk (row-shaped helpers parse;options; STRUCT-typed values keep the client's raw-tag behavior).- Corrected an earlier doc claim: the client's global loss-of-precision default is
NumericRound, notNumericError.
Design notes
Two decisions from review are deliberate API shape: option types stay split (EncodeOption vs ColumnMaskOption) so applicability is fixed at compile time, and ParamsMap / MutationMap remain separate functions because read-only handling is determined by the destination (Params vs mutations).
Requirements
github.com/apstndb/spanvaluev0.7.1+ (gcvctor UTC-timestamp wire format). Formatting of GCVs is owned by spanvalue, so upgrading it alongside spanenc can change rendered output (for example FLOAT64 display); review those golden-test diffs separately from the spanenc adoption.github.com/apstndb/structfieldsv0.1.0 /structfields/spannertagv0.1.0.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.