Merged
Conversation
…ruct Replace single-param interfaces with two-param function types: - Encoder[S,T] func type, Decoder[S,T] func type - Codec[S,T] struct bundling Encode/Decode - StreamEncoder[S], StreamDecoder[S] func types - StreamCodec[S] struct bundling stream Encode/Decode - Remove old Encoder[T], Decoder[T] interfaces and Func wrappers
Remove decorator pattern. Each compression codec now operates on raw bytes. Use goencode.PipeCodec() to compose with serialization codecs.
Also migrate toml codec to Codec[S,T] function type.
- Convert Pipe tests to Examples for godoc visibility - Migrate toml streamcodec to Codec[S,T] function type - Add json/v2 ExampleNewStreamCodec - Fix toml ExampleStreamCodec → ExampleNewStreamCodec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…scii85, pem Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Moved to .claude/data/superpowers/ which is gitignored. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ml, gob, asn1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…se32, hex, ascii85, pem Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…td, brotli Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…/v2, msgpack/* Move json/v2 NewStreamCodec from codec.go to streamcodec.go. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… yaml/v2, v3, v4 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace the
Codec[T]interface with generic function-type structs (Codec[S,T],StreamCodec[S]) and add type-safePipeCodeccomposition. Export standaloneEncoder,Decoder,StreamEncoder, andStreamDecoderconstructors across all codec packages.Type of Change
Changes
Codec[T]interface andEncoderFunc/DecoderFuncwithEncoder[S,T],Decoder[S,T],Codec[S,T]function-type structsStreamEncoder[S]/StreamDecoder[S]interfaces with function types bundled inStreamCodec[S]PipeEncoder,PipeDecoder,PipeCodecfor type-safe codec chainingNewEncoder/NewDecoder/NewStreamEncoder/NewStreamDecoderin all codec packagesStreamCodecsupport to yaml/v2, yaml/v3, yaml/v4, json/v2filecodec to acceptCodec[T, []byte]Checklist