Skip to content

gcvctor: doc clarifications for known traps (BytesValue vs BytesFromSlice, ArrayValue spread, StringBasedValueFromCode scope) #222

Description

@apstndb

Problem

gcvctor doc clarifications for known traps (all documentation-only):

  • BytesValue(nil) vs BytesFromSlice(nil). The former returns non-null empty BYTES (base64 ""), the latter typed NULL — an easy trap when refactoring between them; only nullable_input.go hints at the distinction. Add a one-line cross-reference on BytesValue (and vice versa).
  • ArrayValue(vs...) with an empty slice silently yields ARRAY<INT64>. The zero-argument default is documented, but at a spread call site an empty slice of STRINGs materializes an INT64-typed empty array — a silent type bug. Steer the doc examples toward ArrayValueOf / EmptyArrayOf for slice-spread call sites.
  • StringBasedValueFromCode accepts ARRAY/STRUCT codes, producing a malformed simple Type (no array_element_type / struct_type); the doc only warns about NUMERIC normalization. Add "simple scalar codes only; ARRAY/STRUCT shapes require typector".
  • NullOf(nil) family normalizes to TYPE_CODE_UNSPECIFIED rather than erroring — deliberate and documented, but add a note that Spanner will reject the sentinel, so a nil-Type bug surfaces at the server, not at construction.

From the usability review accompanying the full-codebase review (#200-#214).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationpriority:highShould be addressed soon; correctness or release blocker

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions