Conversation
Signed-off-by: Chen Su <ghosind@gmail.com>
Signed-off-by: Chen Su <ghosind@gmail.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #22 +/- ##
==========================================
- Coverage 94.20% 93.04% -1.16%
==========================================
Files 21 21
Lines 1725 1539 -186
==========================================
- Hits 1625 1432 -193
+ Misses 73 70 -3
- Partials 27 37 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds JSON marshaling and unmarshaling support to all collection and dictionary types by implementing MarshalJSON and UnmarshalJSON methods. The changes enable both direct method calls and usage with the standard json.Marshal/json.Unmarshal functions.
Key changes:
- Added
JSONMarshalerandJSONUnmarshalerinterface definitions to the core Collection and Dict interfaces - Implemented JSON serialization for all set, list, and dictionary types (sets/lists as arrays, dicts as objects)
- Added comprehensive test coverage for JSON operations across all implementations
- Refactored test helper type names for consistency (e.g.,
setTestConstructor→setConstructor)
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| encoding.go | Defines JSONMarshaler and JSONUnmarshaler interface aliases |
| collection.go | Adds JSON interface requirements to Collection interface |
| dict.go | Adds JSON interface requirements to Dict interface |
| set/hash_set.go | Implements MarshalJSON/UnmarshalJSON for HashSet |
| set/sync_set.go | Implements MarshalJSON/UnmarshalJSON for thread-safe SyncSet |
| list/array_list.go | Implements MarshalJSON/UnmarshalJSON for ArrayList |
| list/linked_list.go | Implements MarshalJSON/UnmarshalJSON for LinkedList with zero-value handling |
| list/copy_on_write_array_list.go | Implements MarshalJSON/UnmarshalJSON for CopyOnWriteArrayList |
| dict/hash_dict.go | Implements MarshalJSON/UnmarshalJSON for HashDict |
| dict/sync_dict.go | Implements MarshalJSON/UnmarshalJSON for thread-safe SyncDict |
| set/set_test.go | Adds testSetJSON and consolidates test helpers; renames constructor type |
| set/hash_set_test.go | Removes redundant test calls (moved to common testSet) |
| set/sync_set_test.go | Removes redundant test calls (moved to common testSet) |
| set/set_go123_test.go | Updates function signature to use renamed constructor type |
| list/list_test.go | Adds testListJSON for JSON operations testing |
| dict/dict_test.go | Adds testDictJSON and renames constructor type for consistency |
| dict/dict_go123_test.go | Updates function signatures to use renamed constructor type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Chen Su <ghosind@gmail.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
For #18, this PR adds
MarshalJSONandUnmarshalJSONmethods for the collections and dictionaries.There are two ways to marshal/unmarshal the types to JSON:
MarshalJSON/UnmarshalJSON:json.Marshal/json.Unmarshal: