Commit graph

7 commits

Author SHA1 Message Date
05d806adff
Add JSON marshaling support for Variable types
Introduced a NewVariable function for creating generics-based Variable types. Added MarshalJSON methods to support JSON encoding for various Nil types, ensuring proper handling of nil values. Updated tests and examples to verify the new marshaling functionality.
2024-09-02 12:13:54 +02:00
1150734ab0
Remove redundant Get() method
The Get() method was simply an alias for the Value() method and did not add any functionality. This simplification makes the code cleaner and reduces unnecessary duplication, improving maintainability.
2024-09-01 21:14:46 +02:00
89d0a3f00e
Add comprehensive nil type JSON unmarshal tests
This commit restructures and extends the JSON unmarshal tests for nil types to cover more data types, including boolean, byte slice, float32, float64, int, int64, string, and various unsigned integers. Each test ensures proper handling of value retrieval, nil checks, and reset behavior, enhancing the robustness of the unmarshal functionality.
2024-09-01 19:48:57 +02:00
ab747282c8
Add example for Nil value JSON unmarshaling
Introduced ExampleVariable_UnmarshalJSON to demonstrate unmarshaling of JSON with nil and non-nil fields. This includes handling for multiple custom types and provides a sample output. Added necessary imports and error handling for clarity.
2024-09-01 17:04:55 +02:00
80f2ea15a5
Add additional nil checks in niljson_test.go
Enhanced the test coverage by adding nil checks for ByteSlice and Float32 types after reset. This ensures that more types are adequately handled and validated for nil values in the tests. Additionally, included a check for the string using the Get method.
2024-09-01 16:51:10 +02:00
4224968915
Add support for additional types in niljson
Enhanced the niljson package to include support for byte slices and float32 types. Updated the test cases to validate these new types and modified method names to be more consistent.
2024-09-01 16:41:53 +02:00
03f6fd14d1
Initial checkin 2024-09-01 16:01:58 +02:00