Skip to content

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+.