v0.1.0
Initial release. Experimental: the API may change while encodeValue parity is proven against client library releases. Mirrored behavior tracks cloud.google.com/go/spanner v1.84.1.
Added
ValueOf(any) (spanner.GenericColumnValue, error)— Go value → GCV mirroring the client's internalencodeValue: all concrete parameter/mutation types (scalars,spanner.Null*wrappers includingsql.NullStringanduuid.NullUUID, pointers and slices with typed-NULL rules),spanner.Encoder, protobuf messages and enums (including typed-nil → typed NULL), named variants of base types (getDecodableSpannerTypebehavior), Go structs and struct slices as STRUCT values,spanner.CommitTimestamp, andGenericColumnValuepassthrough (deep clone).TypeFor[T]()/TypeFromGoType(reflect.Type)— static Go type →*sppb.Typeinference;ErrTypeNotInferablefor value-dependent types (spanner.Encoder,GenericColumnValue,NullProtoMessage/NullProtoEnum, interfaces).StructColumns[T]()/StructColumnsFromGoType—spanner-tag column names with the client's mutation/ToStructfield listing (embedded flattening, shadowing,spanner:"-"), the helper requested in googleapis/google-cloud-go#13800.RowTypeFor[T]()/RowTypeFromGoType— row-shaped*sppb.StructTypefor writer metadata.StructColumnsAndValues(any)— struct → column names + GCVs for spanvalue/writer.MutationColumnsAndValues(any)/MutationMap(any)— struct → plain Go cols/vals or map for the non-Struct mutation constructors (spanner.Update,spanner.UpdateMap, ...), enabling column masking by name.ValuesFromSlice[T]/ArrayValueFromSlice[T]— homogeneous slice → (element*sppb.Type,[]*structpb.Value) or ARRAY GCV; interface element types rejected.- Sentinel errors:
ErrUnsupportedType,ErrUntypedNil,ErrNotStruct,ErrNilStructPointer,ErrEmbeddedStructField,ErrTypeNotInferable,ErrInvalidSource,ErrNumericOutOfRange.
Semantics
Deliberate strictness divergences from the client are documented in the package documentation: untyped nil and nil struct pointers return errors, GCV inputs with nil Type are rejected, NUMERIC is always validated, and non-finite floats / JSON use gcvctor's canonical wire forms.
Dependencies
github.com/apstndb/structfieldsv0.1.0 — Apache-2.0 exported fork ofcloud.google.com/go/internal/fields; all upstream-derived code lives there, keeping spanenc MIT.github.com/apstndb/spanvalueis pinned to a pseudo-version of main (v0.7.1-0.20260610130420) because v0.7.0 predates gcvctor's UTC-timestamp fix; it will move to the next tagged release.