Skip to content

docs: add Column Codecs page#300

Draft
arv wants to merge 1 commit into
mainfrom
arv/codec-docs
Draft

docs: add Column Codecs page#300
arv wants to merge 1 commit into
mainfrom
arv/codec-docs

Conversation

@arv
Copy link
Copy Markdown
Contributor

@arv arv commented Jun 2, 2026

What

Adds a new Column Codecs documentation page (contents/docs/codecs.mdx) and a nav entry under Schema.

The page documents the .codec() schema builder API from rocicorp/mono#6087:

  • The .codec() API — storage type vs app type, decode (read) / encode (write + filter), and that the type parameter is the app-side type.
  • Custom codec examples: a JSON column backed by a class instance, and using Zod 4.1+ z.codec() directly.
  • Behavior across query results (auto-decoded), filtering (where encodes app values), ordering (sorts on raw storage values), and mutations (encode on write).

Why

.codec() is a new schema feature with no docs yet. This gives users a single reference for how stored vs app types work and how codecs interact with reads, writes, filters, and ordering.

Notes for reviewers

  • Verified every API claim against the implementation PR, the published @rocicorp/zero types, and Zod 4.4.3's type defs (the z.codec() object really does expose synchronous .decode() / .encode() methods that match Zero's expected shape).
  • Uses useQuery for both React and Solid, consistent with the rest of the docs (createQuery is deprecated in the Solid bindings).
  • Notes that null/undefined bypass the codec, so codec functions only handle real values and compose with .optional().
  • The page leans on Temporal.Instant as the running example; Temporal still needs a polyfill in most current runtimes. Left as-is for now — flagging in case we'd rather lead with a plain Date codec.

🤖 Generated with Claude Code

Document the `.codec()` schema builder API: storage-type vs app-type
columns, automatic decode on read and encode on write/filter, custom
codec examples (JSON-backed class, Zod 4.1 codecs), and behavior in
query results, filtering, ordering, and mutations. Add a nav entry
under Schema.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zero-docs Ready Ready Preview, Comment Jun 2, 2026 2:03pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant