Skip to content

Releases: apstndb/spancodec

v0.1.2

Choose a tag to compare

@apstndb apstndb released this 12 Jun 09:50
e288bab

Patch release since v0.1.1.

Fixed

  • Slice type inference honors element WithGoType registrations (#1 / #2, found by spanpg as the first external consumer of the injection options): TypeFor[[]big.Rat](WithGoType[big.Rat](PGNumeric)) now returns ARRAY<PG_NUMERIC>, matching what ValueOf already produced. Precedence is identical on both sides: exact []T registration > element registration > client mirror. With no options nothing changes (pinned). Consumers can drop slice-type registration workarounds.

Added

  • WithTypedValueEncoder[T](typ, f) (#3) — the pre-composed WithValueEncoder + WithGoType pair, surveyed from spanpg's EncodeOptions (encoder registrations almost always want both halves).

Requirements

Unchanged from v0.1.1: spanvalue v0.7.3+ (v0.7.4+ for writer.WriteRowSeq streaming), spanner v1.84.1 MVS floor (mirrored semantics track v1.91.0), Go 1.24+.

v0.1.1

Choose a tag to compare

@apstndb apstndb released this 11 Jun 16:21
8ab7302

Patch release since v0.1.0. No code changes.

Go floor relaxed to 1.24

v0.1.0 declared go 1.25.0, inherited from spanenc's initial scaffold where transitive dependencies fetched at then-latest (OpenTelemetry v1.43, golang.org/x/net v0.52, golang.org/x/crypto v0.49, ...) declare go 1.25.0 and forced the main-module directive up. No API in this module requires Go 1.25. This release drops the inflated indirect pins and re-tidies the graph at the MVS minimums implied by the direct dependencies — matching spanvalue, which holds its floor at go 1.24.0 — so downstream modules keep control of both dependency versions and the Go floor.

Requirements

  • Go 1.24+ (was 1.25 in v0.1.0).
  • Unchanged from v0.1.0 otherwise: github.com/apstndb/spanvalue v0.7.3+ (v0.7.4+ for writer.WriteRowSeq streaming), cloud.google.com/go/spanner v1.84.1 MVS floor (mirrored semantics track v1.91.0).

v0.1.0

Choose a tag to compare

@apstndb apstndb released this 11 Jun 15:54
46fc227

First release. spancodec merges and supersedes spanenc (last standalone release: v0.3.2) and spandec (never released standalone) into a single codec module: encoding mirrors the client's internal encodeValue semantics (tracked at cloud.google.com/go/spanner v1.91.0), decoding delegates to the client with extension shapes for destinations it rejects today.

Carried over

  • Everything in spanenc v0.3.2: ValueOf, TypeFor/TypeFromGoType, StructColumns, RowTypeFor, ResultSetMetadataFor, StructColumnsAndValues, RowEncoder[T] (Values/Row/Rows/MustResultSetMetadata), MutationColumnsAndValues/MutationMap/ParamsMap with column masks, ValuesFromSlice/ArrayValueFromSlice, WithLossOfPrecisionHandling, WithValueEncoder/WithGoType.
  • All of spandec: Decode, ToStruct (client-delegating, with the *T named-scalar pointer / []T struct slice / json.RawMessage extensions tied to googleapis/google-cloud-go#12576 / #11090 / #10720), WithValueDecoder.

Breaking changes relative to spanenc v0.3.x (batched into the rename)

  • NewRowEncoder[T](opts ...RowEncoderOption)RowEncoderOption is the union interface satisfied by both ColumnMaskOption and EncodeOption. Construction-time WithValueEncoder / WithGoType registrations now inform RowType / ResultSetMetadata, and per-call Values options layer on a map-cloned copy (encoder state never mutates; safe for concurrent use). Existing call sites compile unchanged unless they spread a []ColumnMaskOption. Resolves apstndb/spanenc#5 phase 2.
  • Static inference takes optionsTypeFor / TypeFromGoType / RowTypeFor / RowTypeFromGoType / ResultSetMetadataFor / ResultSetMetadataFromGoType accept opts ...EncodeOption; WithGoType registrations win over inference (fresh clone returned) and resolve []T via the element registration.
  • One ErrFallthrough for both directions (spanenc and spandec each had their own).

See the README migration table.

Requirements

  • github.com/apstndb/spanvalue v0.7.3+ (gcvctor client-compatible JSONFromNullable/PGJSONBFromNullable); streaming RowEncoder.Rows through writer.WriteRowSeq needs v0.7.4+.
  • 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.
  • Go 1.24+.