Skip to content

v0.3.0-alpha.2

Pre-release
Pre-release

Choose a tag to compare

@apstndb apstndb released this 10 Jun 17:47
b4f11c5

Pre-release adding result-set-shaped helpers surveyed from spanner-mycli / spannersh use cases (client-side virtual result sets such as SHOW-style outputs and status rows). Mirrored semantics still track cloud.google.com/go/spanner v1.91.0; go.mod stays at the v1.84.1 MVS floor.

Added

  • ResultSetMetadataFor[T]() / ResultSetMetadataFromGoType(reflect.Type) — wraps RowTypeFor into *sppb.ResultSetMetadata, the shape expected by result-set consumers such as spanvalue/writer's WithMetadata.
  • RowEncoder[T] (NewRowEncoder[T](maskOpts ...ColumnMaskOption)) — compiled row codec for streaming many rows of one struct type: field listing, column mask validation, and row type are resolved once at construction instead of per row.
    • Columns() []string, RowType() (*sppb.StructType, error), ResultSetMetadata() (*sppb.ResultSetMetadata, error) (all mask-aware), Values(v T, opts ...EncodeOption) ([]spanner.GenericColumnValue, error).
    • Read-shaped like StructColumnsAndValues (read-only fields included; an include mask may name them); a test pins the agreement between RowEncoder and StructColumnsAndValues.
    • T may be a struct or pointer-to-struct type; a nil pointer row returns ErrNilStructPointer.
    • Includes a writer integration test streaming a SHOW VARIABLES-style virtual result set to CSV.

Notes

Everything from v0.3.0-alpha.1 (column masks, WithLossOfPrecisionHandling, ParamsMap) is included. Versioning policy (now recorded in AGENTS.md): the module stays on v0; breaking changes bump the minor version, everything else the patch version.

Requirements

  • github.com/apstndb/spanvalue v0.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/structfields v0.1.0 / structfields/spannertag v0.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.

(Requirements section added 2026-06-11.)